Index: chromecast/browser/cast_browser_main_parts.cc |
diff --git a/chromecast/browser/cast_browser_main_parts.cc b/chromecast/browser/cast_browser_main_parts.cc |
index 91454778949ab50dce0f3b818a5af7e2fab9ce6e..216fc2c4e80a7e926d15de3f2b2b4e5edafeee98 100644 |
--- a/chromecast/browser/cast_browser_main_parts.cc |
+++ b/chromecast/browser/cast_browser_main_parts.cc |
@@ -32,6 +32,7 @@ |
#include "chromecast/browser/cast_memory_pressure_monitor.h" |
#include "chromecast/browser/cast_net_log.h" |
#include "chromecast/browser/devtools/remote_debugging_server.h" |
+#include "chromecast/browser/geolocation/cast_access_token_store.h" |
#include "chromecast/browser/metrics/cast_metrics_prefs.h" |
#include "chromecast/browser/metrics/cast_metrics_service_client.h" |
#include "chromecast/browser/pref_service_helper.h" |
@@ -49,6 +50,8 @@ |
#include "components/prefs/pref_registry_simple.h" |
#include "content/public/browser/browser_thread.h" |
#include "content/public/browser/child_process_security_policy.h" |
+#include "content/public/browser/geolocation_delegate.h" |
+#include "content/public/browser/geolocation_provider.h" |
#include "content/public/browser/gpu_data_manager.h" |
#include "content/public/browser/storage_partition.h" |
#include "content/public/common/content_switches.h" |
@@ -184,6 +187,22 @@ namespace shell { |
namespace { |
+// A provider of services for Geolocation. |
+class CastGeolocationDelegate : public content::GeolocationDelegate { |
+ public: |
+ explicit CastGeolocationDelegate(CastBrowserContext* context) |
+ : context_(context) {} |
+ |
+ scoped_refptr<content::AccessTokenStore> CreateAccessTokenStore() override { |
+ return new CastAccessTokenStore(context_); |
+ } |
+ |
+ private: |
+ CastBrowserContext* context_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(CastGeolocationDelegate); |
+}; |
+ |
struct DefaultCommandLineSwitch { |
const char* const switch_name; |
const char* const switch_value; |
@@ -451,6 +470,9 @@ void CastBrowserMainParts::PreMainMessageLoopRun() { |
#endif |
::media::InitializeMediaLibrary(); |
+ content::GeolocationProvider::SetGeolocationDelegate( |
+ new CastGeolocationDelegate(cast_browser_process_->browser_context())); |
+ |
// Initializing metrics service and network delegates must happen after cast |
// service is intialized because CastMetricsServiceClient and |
// CastNetworkDelegate may use components initialized by cast service. |