New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 725063 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Email to this user bounced
Closed: Nov 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 3
Type: Bug

Blocked on:
issue 725062

Blocking:
issue 725058



Sign in to add a comment

Change //content to use GeolocationContext to support overriding geolocation on per-tab basis

Project Member Reported by blundell@chromium.org, May 22 2017

Issue description

This change has two parts:

- Change //content to handle GeolocationService requests by calling the GeolocationServiceContext Mojo interface

- Change devtools to implement overriding the user’s location by calling the GeolocationServiceContext Mojo interface
 
Components: Blink>Location
Labels: DeviceService OS-All
Status: Available (was: Untriaged)
Blockedon: 725062
Blocking: 725058
Components: Blink>Geolocation
Components: -Blink>Location
Summary: Change //content to use GeolocationContext to support overriding geolocation on per-tab basis (was: Change //content to use GeolocationServiceContext to support overriding geolocation on per-tab basis)
Note that the state of the world has change some, as there is now a GeolocationService Mojo interface that handles permission requests and should stay in //content. The current design is described in the design doc: https://docs.google.com/document/d/1V-HsypJveArl_LQox4ksxC7kTl7vnhlCudhbU6o0tRQ/edit#

Comment 6 by ke...@intel.com, Oct 18 2017

Cc: blundell@chromium.org
Owner: ke...@intel.com
Hi, Colin, My understanding on this task:

Currently each WebContentsImpl owns a GeolocationContext. After adding the GeolocationContext mojo interface, each WebContentsImpl owns a mojom::GeolocationContextPtr. So Devtools can get the raw pointer of the mojom::GeolocationContextPtr from WebContents to do the override-location.
Also, the GeolocationServiceImpl takes a raw pointer of mojom::GeolocationContextPtr instead of the device::GeolocationContext* as parameter in its constructor.

WebContentsImpl inits mojom::GeolocationContextPtr and creates the mojo connection in its constructor. In //device side, the GeolocationContext instance is strong-bound to the mojo connection.

If correct I'm going to start change code:)
Thanks.

Comment 7 by ke...@intel.com, Oct 18 2017

Status: Started (was: Available)

Comment 8 by ke...@intel.com, Oct 18 2017

And, Host the GeolocationContext by DeviceService. DeviceService is only responsible for strong-bindingly creating GeolocationContext, not care the deleting.
So the WebContentsImpl can connect Device Service to build the GeolocationContext mojo connection.
Yes, this sounds correct. It should be conceptually similar to how WakeLockContext works, which is in line with the understanding you're presenting here.
Cc: amoylan@chromium.org
Project Member

Comment 12 by bugdroid1@chromium.org, Nov 4 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/fa3b72fd45cc3e1e2d58765498432a0c28113612

commit fa3b72fd45cc3e1e2d58765498432a0c28113612
Author: Ke He <ke.he@intel.com>
Date: Sat Nov 04 03:57:43 2017

Remove device::Geoposition, use device::mojom::Geoposition everywhere.

BUG= 725063 

Change-Id: Id078a7e0c6795052a77cc05ecdcbdb4e5a96effd
Reviewed-on: https://chromium-review.googlesource.com/732197
Reviewed-by: Tim Volodine <timvolodine@chromium.org>
Reviewed-by: Scott Violet <sky@chromium.org>
Reviewed-by: Ken Rockot <rockot@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Reviewed-by: Colin Blundell (OOO until November 6) <blundell@chromium.org>
Commit-Queue: Ke He <ke.he@intel.com>
Cr-Commit-Position: refs/heads/master@{#514026}
[modify] https://crrev.com/fa3b72fd45cc3e1e2d58765498432a0c28113612/chrome/browser/geolocation/geolocation_browsertest.cc
[modify] https://crrev.com/fa3b72fd45cc3e1e2d58765498432a0c28113612/chrome/test/base/ui_test_utils.cc
[modify] https://crrev.com/fa3b72fd45cc3e1e2d58765498432a0c28113612/components/autofill/content/browser/BUILD.gn
[modify] https://crrev.com/fa3b72fd45cc3e1e2d58765498432a0c28113612/components/autofill/content/browser/risk/fingerprint.cc
[modify] https://crrev.com/fa3b72fd45cc3e1e2d58765498432a0c28113612/components/autofill/content/browser/risk/fingerprint_browsertest.cc
[modify] https://crrev.com/fa3b72fd45cc3e1e2d58765498432a0c28113612/content/browser/BUILD.gn
[modify] https://crrev.com/fa3b72fd45cc3e1e2d58765498432a0c28113612/content/browser/devtools/protocol/emulation_handler.cc
[modify] https://crrev.com/fa3b72fd45cc3e1e2d58765498432a0c28113612/content/browser/geolocation/geolocation_service_impl_unittest.cc
[modify] https://crrev.com/fa3b72fd45cc3e1e2d58765498432a0c28113612/content/shell/BUILD.gn
[modify] https://crrev.com/fa3b72fd45cc3e1e2d58765498432a0c28113612/content/shell/browser/layout_test/layout_test_browser_context.cc
[modify] https://crrev.com/fa3b72fd45cc3e1e2d58765498432a0c28113612/device/geolocation/BUILD.gn
[modify] https://crrev.com/fa3b72fd45cc3e1e2d58765498432a0c28113612/device/geolocation/fake_location_provider.cc
[modify] https://crrev.com/fa3b72fd45cc3e1e2d58765498432a0c28113612/device/geolocation/fake_location_provider.h
[modify] https://crrev.com/fa3b72fd45cc3e1e2d58765498432a0c28113612/device/geolocation/geolocation_context.cc
[modify] https://crrev.com/fa3b72fd45cc3e1e2d58765498432a0c28113612/device/geolocation/geolocation_context.h
[modify] https://crrev.com/fa3b72fd45cc3e1e2d58765498432a0c28113612/device/geolocation/geolocation_impl.cc
[modify] https://crrev.com/fa3b72fd45cc3e1e2d58765498432a0c28113612/device/geolocation/geolocation_impl.h
[modify] https://crrev.com/fa3b72fd45cc3e1e2d58765498432a0c28113612/device/geolocation/geolocation_provider.h
[modify] https://crrev.com/fa3b72fd45cc3e1e2d58765498432a0c28113612/device/geolocation/geolocation_provider_impl.cc
[modify] https://crrev.com/fa3b72fd45cc3e1e2d58765498432a0c28113612/device/geolocation/geolocation_provider_impl.h
[modify] https://crrev.com/fa3b72fd45cc3e1e2d58765498432a0c28113612/device/geolocation/geolocation_provider_impl_unittest.cc
[delete] https://crrev.com/f3af94d058283ac92dfa7411b1f00a0c45966b04/device/geolocation/geoposition.cc
[delete] https://crrev.com/f3af94d058283ac92dfa7411b1f00a0c45966b04/device/geolocation/geoposition.h
[modify] https://crrev.com/fa3b72fd45cc3e1e2d58765498432a0c28113612/device/geolocation/location_api_adapter_android.cc
[modify] https://crrev.com/fa3b72fd45cc3e1e2d58765498432a0c28113612/device/geolocation/location_api_adapter_android.h
[modify] https://crrev.com/fa3b72fd45cc3e1e2d58765498432a0c28113612/device/geolocation/location_arbitrator.cc
[modify] https://crrev.com/fa3b72fd45cc3e1e2d58765498432a0c28113612/device/geolocation/location_arbitrator.h
[modify] https://crrev.com/fa3b72fd45cc3e1e2d58765498432a0c28113612/device/geolocation/location_arbitrator_unittest.cc
[modify] https://crrev.com/fa3b72fd45cc3e1e2d58765498432a0c28113612/device/geolocation/location_provider.h
[modify] https://crrev.com/fa3b72fd45cc3e1e2d58765498432a0c28113612/device/geolocation/location_provider_android.cc
[modify] https://crrev.com/fa3b72fd45cc3e1e2d58765498432a0c28113612/device/geolocation/location_provider_android.h
[modify] https://crrev.com/fa3b72fd45cc3e1e2d58765498432a0c28113612/device/geolocation/network_location_provider.cc
[modify] https://crrev.com/fa3b72fd45cc3e1e2d58765498432a0c28113612/device/geolocation/network_location_provider.h
[modify] https://crrev.com/fa3b72fd45cc3e1e2d58765498432a0c28113612/device/geolocation/network_location_provider_unittest.cc
[modify] https://crrev.com/fa3b72fd45cc3e1e2d58765498432a0c28113612/device/geolocation/network_location_request.cc
[modify] https://crrev.com/fa3b72fd45cc3e1e2d58765498432a0c28113612/device/geolocation/network_location_request.h
[add] https://crrev.com/fa3b72fd45cc3e1e2d58765498432a0c28113612/device/geolocation/public/cpp/BUILD.gn
[add] https://crrev.com/fa3b72fd45cc3e1e2d58765498432a0c28113612/device/geolocation/public/cpp/geoposition.cc
[add] https://crrev.com/fa3b72fd45cc3e1e2d58765498432a0c28113612/device/geolocation/public/cpp/geoposition.h
[modify] https://crrev.com/fa3b72fd45cc3e1e2d58765498432a0c28113612/device/geolocation/public/interfaces/geoposition.mojom

Components: Internals>Services>Device
Project Member

Comment 14 by bugdroid1@chromium.org, Nov 9 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/cc3a6160dd368e76fefc6919f3f36b7cc6c252cf

commit cc3a6160dd368e76fefc6919f3f36b7cc6c252cf
Author: Ke He <ke.he@intel.com>
Date: Thu Nov 09 05:17:21 2017

Change the geolocation.mojom to use mojo::common::mojom::Time.

mojo::common.mojom.Time already has typemappings to both base::Time and
WTF::Time. This type is preferred instead of using a double to represent
time.

BUG= 725063 

Change-Id: I9817946de036f2cf3a1923dcdc359a114cb07655
Reviewed-on: https://chromium-review.googlesource.com/753440
Commit-Queue: Ke He <ke.he@intel.com>
Reviewed-by: Jochen Eisinger <jochen@chromium.org>
Reviewed-by: Miguel Casas <mcasas@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Ken Rockot <rockot@chromium.org>
Cr-Commit-Position: refs/heads/master@{#515106}
[modify] https://crrev.com/cc3a6160dd368e76fefc6919f3f36b7cc6c252cf/chrome/test/base/ui_test_utils.cc
[modify] https://crrev.com/cc3a6160dd368e76fefc6919f3f36b7cc6c252cf/components/autofill/content/browser/risk/fingerprint.cc
[modify] https://crrev.com/cc3a6160dd368e76fefc6919f3f36b7cc6c252cf/components/autofill/content/browser/risk/fingerprint_browsertest.cc
[modify] https://crrev.com/cc3a6160dd368e76fefc6919f3f36b7cc6c252cf/content/browser/devtools/protocol/emulation_handler.cc
[modify] https://crrev.com/cc3a6160dd368e76fefc6919f3f36b7cc6c252cf/content/shell/browser/layout_test/layout_test_browser_context.cc
[modify] https://crrev.com/cc3a6160dd368e76fefc6919f3f36b7cc6c252cf/device/geolocation/geolocation_provider_impl_unittest.cc
[modify] https://crrev.com/cc3a6160dd368e76fefc6919f3f36b7cc6c252cf/device/geolocation/location_api_adapter_android.cc
[modify] https://crrev.com/cc3a6160dd368e76fefc6919f3f36b7cc6c252cf/device/geolocation/location_arbitrator.cc
[modify] https://crrev.com/cc3a6160dd368e76fefc6919f3f36b7cc6c252cf/device/geolocation/location_arbitrator.h
[modify] https://crrev.com/cc3a6160dd368e76fefc6919f3f36b7cc6c252cf/device/geolocation/location_arbitrator_unittest.cc
[modify] https://crrev.com/cc3a6160dd368e76fefc6919f3f36b7cc6c252cf/device/geolocation/network_location_provider.cc
[modify] https://crrev.com/cc3a6160dd368e76fefc6919f3f36b7cc6c252cf/device/geolocation/network_location_provider_unittest.cc
[modify] https://crrev.com/cc3a6160dd368e76fefc6919f3f36b7cc6c252cf/device/geolocation/network_location_request.cc
[modify] https://crrev.com/cc3a6160dd368e76fefc6919f3f36b7cc6c252cf/device/geolocation/public/cpp/geoposition.cc
[modify] https://crrev.com/cc3a6160dd368e76fefc6919f3f36b7cc6c252cf/device/geolocation/public/interfaces/BUILD.gn
[modify] https://crrev.com/cc3a6160dd368e76fefc6919f3f36b7cc6c252cf/device/geolocation/public/interfaces/geoposition.mojom
[modify] https://crrev.com/cc3a6160dd368e76fefc6919f3f36b7cc6c252cf/third_party/WebKit/LayoutTests/geolocation-api/resources/geolocation-mock.js
[modify] https://crrev.com/cc3a6160dd368e76fefc6919f3f36b7cc6c252cf/third_party/WebKit/Source/modules/geolocation/Geolocation.cpp

Project Member

Comment 15 by bugdroid1@chromium.org, Nov 9 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/7319dbe0a3e19f862844a97b81d297e3917b8f1a

commit 7319dbe0a3e19f862844a97b81d297e3917b8f1a
Author: Ke He <ke.he@intel.com>
Date: Thu Nov 09 05:54:44 2017

Add GeolocationContext mojo interface.

This CL is one step of the Geolocation Servicification project.
Before moving geolocation core to //services, both //content and //devtools
shouldn't call the device::GeolocationContext directly, instead, they should
call via mojo.

1) Add GeolocationContext mojo interface.
2) Host the GeolocationContext by Device Service.
3) Change devtool to call the GeolocationContext mojo interface.

My test steps in Ubuntu-16.04: 
1) Build out a executable chrome, you need to obtain a Google API key
and provide it to Chromium either at build time or at runtime. See how
to do in https://www.chromium.org/developers/how-tos/api-keys

2) I setup a SimpleHTTPServer by python, add the test pages like:
<script type="text/javascript">
if (navigator.geolocation)
{  navigator.geolocation.getCurrentPosition(
     function( position ) {  
	show_msg( position );
     },
     function( err ) {
        alert('error!')
     })
}
else
   alert( 'your browser doesn't support Geolocation' );
	  
function show_msg( position )
{   var lat = position.coords.latitude;
    var lng = position.coords.longitude;
    alert( "latitude:" + lat + ",longitude" + lng );
}
</script>

3) Visit the test page, verify chrome can get the Geo-position.
4) In DevTools, choose 'Console', press "ESC" then the 'Sensors' panel
shows, change the 'Geolocation' dropbox value, verify the Geo-position is
overrided.

BUG= 725063 

Cq-Include-Trybots: master.tryserver.chromium.linux:linux_site_isolation
Change-Id: Ic92e3d4b10db763e6eb9dec2fa59fd0240469592
Reviewed-on: https://chromium-review.googlesource.com/735204
Commit-Queue: Ke He <ke.he@intel.com>
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Tim Volodine <timvolodine@chromium.org>
Reviewed-by: Colin Blundell <blundell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#515110}
[modify] https://crrev.com/7319dbe0a3e19f862844a97b81d297e3917b8f1a/content/browser/devtools/protocol/emulation_handler.cc
[modify] https://crrev.com/7319dbe0a3e19f862844a97b81d297e3917b8f1a/content/browser/frame_host/render_frame_host_delegate.cc
[modify] https://crrev.com/7319dbe0a3e19f862844a97b81d297e3917b8f1a/content/browser/frame_host/render_frame_host_delegate.h
[modify] https://crrev.com/7319dbe0a3e19f862844a97b81d297e3917b8f1a/content/browser/frame_host/render_frame_host_impl.cc
[modify] https://crrev.com/7319dbe0a3e19f862844a97b81d297e3917b8f1a/content/browser/geolocation/geolocation_service_impl.cc
[modify] https://crrev.com/7319dbe0a3e19f862844a97b81d297e3917b8f1a/content/browser/geolocation/geolocation_service_impl.h
[modify] https://crrev.com/7319dbe0a3e19f862844a97b81d297e3917b8f1a/content/browser/web_contents/web_contents_impl.cc
[modify] https://crrev.com/7319dbe0a3e19f862844a97b81d297e3917b8f1a/content/browser/web_contents/web_contents_impl.h
[modify] https://crrev.com/7319dbe0a3e19f862844a97b81d297e3917b8f1a/content/public/app/mojo/content_browser_manifest.json
[modify] https://crrev.com/7319dbe0a3e19f862844a97b81d297e3917b8f1a/device/geolocation/geolocation_context.cc
[modify] https://crrev.com/7319dbe0a3e19f862844a97b81d297e3917b8f1a/device/geolocation/geolocation_context.h
[modify] https://crrev.com/7319dbe0a3e19f862844a97b81d297e3917b8f1a/device/geolocation/public/interfaces/BUILD.gn
[add] https://crrev.com/7319dbe0a3e19f862844a97b81d297e3917b8f1a/device/geolocation/public/interfaces/geolocation_context.mojom
[modify] https://crrev.com/7319dbe0a3e19f862844a97b81d297e3917b8f1a/services/device/BUILD.gn
[modify] https://crrev.com/7319dbe0a3e19f862844a97b81d297e3917b8f1a/services/device/device_service.cc
[modify] https://crrev.com/7319dbe0a3e19f862844a97b81d297e3917b8f1a/services/device/device_service.h
[modify] https://crrev.com/7319dbe0a3e19f862844a97b81d297e3917b8f1a/services/device/manifest.json

Comment 16 by ke...@intel.com, Nov 9 2017

Status: Fixed (was: Started)
Both 725062 and 725063 are fixed by one CL: 
https://chromium-review.googlesource.com/735204

Sign in to add a comment