| 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..a0842396f3ed25788a4735f295fd774081376340 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,40 @@ 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_));
|
| + if (!web_contents)
|
| + return Response::InternalError("No WebContents to override");
|
| + GeolocationDispatcherHost* geolocation_host =
|
| + 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());
|
| + return Response::OK();
|
| +}
|
| +
|
| +Response PageHandler::ClearGeolocationOverride() {
|
| + WebContentsImpl* web_contents = static_cast<WebContentsImpl*>(
|
| + WebContents::FromRenderViewHost(host_));
|
| + if (!web_contents)
|
| + return Response::InternalError("No WebContents to override");
|
| + GeolocationDispatcherHost* geolocation_host =
|
| + web_contents->geolocation_dispatcher_host();
|
| + geolocation_host->ClearOverride();
|
| + return Response::OK();
|
| +}
|
| +
|
| +
|
| Response PageHandler::SetTouchEmulationEnabled(bool enabled) {
|
| return Response::FallThrough();
|
| }
|
|
|