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

Side by Side Diff: content/shell/browser/shell_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 unified diff | Download patch
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_browser_main_parts.h" 5 #include "content/shell/browser/shell_browser_main_parts.h"
6 6
7 #include "base/base_switches.h" 7 #include "base/base_switches.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
11 #include "base/files/file_util.h" 11 #include "base/files/file_util.h"
12 #include "base/message_loop/message_loop.h" 12 #include "base/message_loop/message_loop.h"
13 #include "base/threading/thread.h" 13 #include "base/threading/thread.h"
14 #include "base/threading/thread_restrictions.h" 14 #include "base/threading/thread_restrictions.h"
15 #include "build/build_config.h" 15 #include "build/build_config.h"
16 #include "components/devtools_http_handler/devtools_http_handler.h" 16 #include "components/devtools_http_handler/devtools_http_handler.h"
17 #include "content/public/browser/browser_thread.h" 17 #include "content/public/browser/browser_thread.h"
18 #include "content/public/browser/geolocation_delegate.h"
19 #include "content/public/browser/geolocation_provider.h"
18 #include "content/public/browser/storage_partition.h" 20 #include "content/public/browser/storage_partition.h"
19 #include "content/public/common/content_switches.h" 21 #include "content/public/common/content_switches.h"
20 #include "content/public/common/main_function_params.h" 22 #include "content/public/common/main_function_params.h"
21 #include "content/public/common/url_constants.h" 23 #include "content/public/common/url_constants.h"
22 #include "content/shell/browser/shell.h" 24 #include "content/shell/browser/shell.h"
25 #include "content/shell/browser/shell_access_token_store.h"
23 #include "content/shell/browser/shell_browser_context.h" 26 #include "content/shell/browser/shell_browser_context.h"
24 #include "content/shell/browser/shell_devtools_manager_delegate.h" 27 #include "content/shell/browser/shell_devtools_manager_delegate.h"
25 #include "content/shell/browser/shell_net_log.h" 28 #include "content/shell/browser/shell_net_log.h"
26 #include "content/shell/common/shell_switches.h" 29 #include "content/shell/common/shell_switches.h"
27 #include "device/bluetooth/bluetooth_adapter_factory.h" 30 #include "device/bluetooth/bluetooth_adapter_factory.h"
28 #include "net/base/filename_util.h" 31 #include "net/base/filename_util.h"
29 #include "net/base/net_module.h" 32 #include "net/base/net_module.h"
30 #include "net/grit/net_resources.h" 33 #include "net/grit/net_resources.h"
31 #include "ui/base/material_design/material_design_controller.h" 34 #include "ui/base/material_design/material_design_controller.h"
32 #include "ui/base/resource/resource_bundle.h" 35 #include "ui/base/resource/resource_bundle.h"
(...skipping 15 matching lines...) Expand all
48 #include "chromeos/dbus/dbus_thread_manager.h" 51 #include "chromeos/dbus/dbus_thread_manager.h"
49 #include "device/bluetooth/dbus/bluez_dbus_manager.h" 52 #include "device/bluetooth/dbus/bluez_dbus_manager.h"
50 #elif defined(OS_LINUX) 53 #elif defined(OS_LINUX)
51 #include "device/bluetooth/dbus/dbus_bluez_manager_wrapper_linux.h" 54 #include "device/bluetooth/dbus/dbus_bluez_manager_wrapper_linux.h"
52 #endif 55 #endif
53 56
54 namespace content { 57 namespace content {
55 58
56 namespace { 59 namespace {
57 60
61 // A provider of services for Geolocation.
62 class ShellGeolocationDelegate : public content::GeolocationDelegate {
63 public:
64 explicit ShellGeolocationDelegate(ShellBrowserContext* context)
65 : context_(context) {}
66
67 scoped_refptr<content::AccessTokenStore> CreateAccessTokenStore() final {
68 return new ShellAccessTokenStore(context_);
69 }
70
71 private:
72 ShellBrowserContext* context_;
73 DISALLOW_COPY_AND_ASSIGN(ShellGeolocationDelegate);
74 };
75
58 GURL GetStartupURL() { 76 GURL GetStartupURL() {
59 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); 77 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
60 if (command_line->HasSwitch(switches::kContentBrowserTest)) 78 if (command_line->HasSwitch(switches::kContentBrowserTest))
61 return GURL(); 79 return GURL();
62 const base::CommandLine::StringVector& args = command_line->GetArgs(); 80 const base::CommandLine::StringVector& args = command_line->GetArgs();
63 81
64 #if defined(OS_ANDROID) 82 #if defined(OS_ANDROID)
65 // Delay renderer creation on Android until surface is ready. 83 // Delay renderer creation on Android until surface is ready.
66 return GURL(); 84 return GURL();
67 #endif 85 #endif
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 crash_dump_manager_.reset(new breakpad::CrashDumpManager(crash_dumps_dir)); 176 crash_dump_manager_.reset(new breakpad::CrashDumpManager(crash_dumps_dir));
159 } 177 }
160 178
161 return 0; 179 return 0;
162 } 180 }
163 #endif 181 #endif
164 182
165 void ShellBrowserMainParts::PreMainMessageLoopRun() { 183 void ShellBrowserMainParts::PreMainMessageLoopRun() {
166 net_log_.reset(new ShellNetLog("content_shell")); 184 net_log_.reset(new ShellNetLog("content_shell"));
167 InitializeBrowserContexts(); 185 InitializeBrowserContexts();
186 content::GeolocationProvider::SetGeolocationDelegate(
187 new ShellGeolocationDelegate(browser_context()));
168 Shell::Initialize(); 188 Shell::Initialize();
169 net::NetModule::SetResourceProvider(PlatformResourceProvider); 189 net::NetModule::SetResourceProvider(PlatformResourceProvider);
170 190
171 devtools_http_handler_.reset( 191 devtools_http_handler_.reset(
172 ShellDevToolsManagerDelegate::CreateHttpHandler(browser_context_.get())); 192 ShellDevToolsManagerDelegate::CreateHttpHandler(browser_context_.get()));
173 193
174 InitializeMessageLoopContext(); 194 InitializeMessageLoopContext();
175 195
176 if (parameters_.ui_task) { 196 if (parameters_.ui_task) {
177 parameters_.ui_task->Run(); 197 parameters_.ui_task->Run();
(...skipping 17 matching lines...) Expand all
195 device::BluetoothAdapterFactory::Shutdown(); 215 device::BluetoothAdapterFactory::Shutdown();
196 bluez::BluezDBusManager::Shutdown(); 216 bluez::BluezDBusManager::Shutdown();
197 chromeos::DBusThreadManager::Shutdown(); 217 chromeos::DBusThreadManager::Shutdown();
198 #elif defined(OS_LINUX) 218 #elif defined(OS_LINUX)
199 device::BluetoothAdapterFactory::Shutdown(); 219 device::BluetoothAdapterFactory::Shutdown();
200 bluez::DBusBluezManagerWrapperLinux::Shutdown(); 220 bluez::DBusBluezManagerWrapperLinux::Shutdown();
201 #endif 221 #endif
202 } 222 }
203 223
204 } // namespace 224 } // namespace
OLDNEW
« no previous file with comments | « content/public/browser/content_browser_client.cc ('k') | content/shell/browser/shell_content_browser_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698