Index: content/browser/devtools/protocol/page_handler.cc |
diff --git a/content/browser/devtools/protocol/page_handler.cc b/content/browser/devtools/protocol/page_handler.cc |
index 33fac54f483c319a57e3338b220262b7ae632168..d94f16805ebf7e79add088182a68aafb02358e5e 100644 |
--- a/content/browser/devtools/protocol/page_handler.cc |
+++ b/content/browser/devtools/protocol/page_handler.cc |
@@ -5,7 +5,9 @@ |
#include "content/browser/devtools/protocol/page_handler.h" |
#include "base/base64.h" |
+#include "content/browser/geolocation/geolocation_dispatcher_host.h" |
#include "content/browser/renderer_host/render_view_host_impl.h" |
+#include "content/browser/web_contents/web_contents_impl.h" |
namespace content { |
namespace devtools { |
@@ -57,6 +59,36 @@ Response PageHandler::NavigateToHistoryEntry(int entry_id) { |
return Response::FallThrough(); |
} |
+Response PageHandler::SetGeolocationOverride(double* latitude, |
+ double* longitude, |
+ double* accuracy) { |
+ WebContentsImpl* web_contents = static_cast<WebContentsImpl*>( |
+ WebContents::FromRenderViewHost(host_)); |
+ GeolocationDispatcherHost* geolocation_host = |
dgozman
2014/10/06 11:03:26
if (!web_contents)
return Response::InternalErro
vkuzkokov
2014/10/06 13:48:20
Done.
|
+ web_contents->geolocation_dispatcher_host(); |
+ scoped_ptr<Geoposition> geoposition(new Geoposition()); |
+ if (latitude && longitude && accuracy) { |
+ geoposition->latitude = *latitude; |
+ geoposition->longitude = *longitude; |
+ geoposition->accuracy = *accuracy; |
+ geoposition->timestamp = base::Time::Now(); |
+ } else { |
+ geoposition->error_code = Geoposition::ERROR_CODE_POSITION_UNAVAILABLE; |
+ } |
+ geolocation_host->SetOverride(geoposition.Pass()); |
dgozman
2014/10/06 11:03:26
Could |geolocation_host| be NULL?
Michael van Ouwerkerk
2014/10/06 13:38:23
It should really never be, it is instantiated in W
|
+ return Response::OK(); |
+} |
+ |
+Response PageHandler::ClearGeolocationOverride() { |
+ WebContentsImpl* web_contents = static_cast<WebContentsImpl*>( |
dgozman
2014/10/06 11:03:26
Check |web_contents| and maybe |geolocation_host|.
vkuzkokov
2014/10/06 13:48:20
Done.
|
+ WebContents::FromRenderViewHost(host_)); |
+ GeolocationDispatcherHost* geolocation_host = |
+ web_contents->geolocation_dispatcher_host(); |
+ geolocation_host->ClearOverride(); |
+ return Response::OK(); |
+} |
+ |
+ |
Response PageHandler::SetTouchEmulationEnabled(bool enabled) { |
return Response::FallThrough(); |
} |