Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1382)

Unified Diff: android_webview/browser/aw_browser_main_parts.cc

Issue 2174613002: Geolocation: move creation of the GeolocationDelegate to the embedders (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | android_webview/browser/aw_content_browser_client.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: android_webview/browser/aw_browser_main_parts.cc
diff --git a/android_webview/browser/aw_browser_main_parts.cc b/android_webview/browser/aw_browser_main_parts.cc
index 25a21cfdf455739f1dafb7f7b449a920465ce804..91ab5d20f95d91ca61dc36b36515e51da02ba801 100644
--- a/android_webview/browser/aw_browser_main_parts.cc
+++ b/android_webview/browser/aw_browser_main_parts.cc
@@ -20,7 +20,10 @@
#include "base/i18n/rtl.h"
#include "base/path_service.h"
#include "components/crash/content/browser/crash_micro_dump_manager_android.h"
+#include "content/public/browser/access_token_store.h"
#include "content/public/browser/android/synchronous_compositor.h"
+#include "content/public/browser/geolocation_delegate.h"
+#include "content/public/browser/geolocation_provider.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/common/content_client.h"
@@ -36,6 +39,42 @@
#include "ui/gl/gl_surface.h"
namespace android_webview {
+namespace {
+
+class AwAccessTokenStore : public content::AccessTokenStore {
+ public:
+ AwAccessTokenStore() { }
+
+ // content::AccessTokenStore implementation
+ void LoadAccessTokens(const LoadAccessTokensCallback& request) override {
+ AccessTokenStore::AccessTokenMap access_token_map;
+ // AccessTokenMap and net::URLRequestContextGetter not used on Android,
+ // but Run needs to be called to finish the geolocation setup.
+ request.Run(access_token_map, NULL);
+ }
+ void SaveAccessToken(const GURL& server_url,
+ const base::string16& access_token) override {}
+
+ private:
+ ~AwAccessTokenStore() override {}
+
+ DISALLOW_COPY_AND_ASSIGN(AwAccessTokenStore);
+};
+
+// A provider of Geolocation services to override AccessTokenStore.
+class AwGeolocationDelegate : public content::GeolocationDelegate {
+ public:
+ AwGeolocationDelegate() = default;
+
+ scoped_refptr<content::AccessTokenStore> CreateAccessTokenStore() final {
+ return new AwAccessTokenStore();
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(AwGeolocationDelegate);
+};
+
+} // anonymous namespace
AwBrowserMainParts::AwBrowserMainParts(AwBrowserContext* browser_context)
: browser_context_(browser_context) {
@@ -88,6 +127,9 @@ int AwBrowserMainParts::PreCreateThreads() {
void AwBrowserMainParts::PreMainMessageLoopRun() {
browser_context_->PreMainMessageLoopRun();
+ content::GeolocationProvider::SetGeolocationDelegate(
+ new AwGeolocationDelegate());
+
AwDevToolsDiscoveryProvider::Install();
content::RenderFrameHost::AllowInjectingJavaScriptForAndroidWebView();
« no previous file with comments | « no previous file | android_webview/browser/aw_content_browser_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698