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

Side by Side Diff: content/shell/browser/shell_content_browser_client.cc

Issue 2127973002: Geolocation: change GeolocationDelegate to injected by content/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rockot@ comments and sorting out ShellGeolocationDelegate. Rebased. 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 unified diff | Download patch
« no previous file with comments | « content/public/browser/geolocation_provider.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/shell/browser/shell_content_browser_client.h" 5 #include "content/shell/browser/shell_content_browser_client.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/base_switches.h" 10 #include "base/base_switches.h"
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 return crash_handler->GetDeathSignalSocket(); 115 return crash_handler->GetDeathSignalSocket();
116 } 116 }
117 117
118 return -1; 118 return -1;
119 } 119 }
120 #endif // defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) 120 #endif // defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID)
121 121
122 // A provider of services for Geolocation. 122 // A provider of services for Geolocation.
123 class ShellGeolocationDelegate : public content::GeolocationDelegate { 123 class ShellGeolocationDelegate : public content::GeolocationDelegate {
124 public: 124 public:
125 explicit ShellGeolocationDelegate(ShellBrowserContext* context) 125 using GetShellBrowserContextCB = base::Callback<ShellBrowserContext*(void)>;
126 : context_(context) {} 126 explicit ShellGeolocationDelegate(GetShellBrowserContextCB get_context_cb)
127 : get_context_cb_(get_context_cb) {}
127 128
128 scoped_refptr<AccessTokenStore> CreateAccessTokenStore() final { 129 scoped_refptr<AccessTokenStore> CreateAccessTokenStore() final {
129 return new ShellAccessTokenStore(context_); 130 return new ShellAccessTokenStore(get_context_cb_.Run());
130 } 131 }
131 132
132 private: 133 private:
133 ShellBrowserContext* context_; 134 GetShellBrowserContextCB get_context_cb_;
134 135
135 DISALLOW_COPY_AND_ASSIGN(ShellGeolocationDelegate); 136 DISALLOW_COPY_AND_ASSIGN(ShellGeolocationDelegate);
136 }; 137 };
137 138
138 } // namespace 139 } // namespace
139 140
140 ShellContentBrowserClient* ShellContentBrowserClient::Get() { 141 ShellContentBrowserClient* ShellContentBrowserClient::Get() {
141 return g_browser_client; 142 return g_browser_client;
142 } 143 }
143 144
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 ShellBrowserContext* ShellContentBrowserClient::browser_context() { 365 ShellBrowserContext* ShellContentBrowserClient::browser_context() {
365 return shell_browser_main_parts_->browser_context(); 366 return shell_browser_main_parts_->browser_context();
366 } 367 }
367 368
368 ShellBrowserContext* 369 ShellBrowserContext*
369 ShellContentBrowserClient::off_the_record_browser_context() { 370 ShellContentBrowserClient::off_the_record_browser_context() {
370 return shell_browser_main_parts_->off_the_record_browser_context(); 371 return shell_browser_main_parts_->off_the_record_browser_context();
371 } 372 }
372 373
373 GeolocationDelegate* ShellContentBrowserClient::CreateGeolocationDelegate() { 374 GeolocationDelegate* ShellContentBrowserClient::CreateGeolocationDelegate() {
374 return new ShellGeolocationDelegate(browser_context()); 375 return new ShellGeolocationDelegate(base::Bind(
376 &ShellContentBrowserClient::browser_context, base::Unretained(this)));
Ken Rockot(use gerrit already) 2016/07/20 20:47:04 This is pretty weird. Why not just get rid of the
mcasas 2016/07/20 20:53:14 Indeed why not! Done.
375 } 377 }
376 378
377 } // namespace content 379 } // namespace content
OLDNEW
« no previous file with comments | « content/public/browser/geolocation_provider.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698