OLD | NEW |
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" |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/files/file.h" | 12 #include "base/files/file.h" |
13 #include "base/files/file_util.h" | 13 #include "base/files/file_util.h" |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
15 #include "base/path_service.h" | 15 #include "base/path_service.h" |
16 #include "base/strings/pattern.h" | 16 #include "base/strings/pattern.h" |
17 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
18 #include "build/build_config.h" | 18 #include "build/build_config.h" |
19 #include "content/public/browser/client_certificate_delegate.h" | 19 #include "content/public/browser/client_certificate_delegate.h" |
20 #include "content/public/browser/geolocation_delegate.h" | |
21 #include "content/public/browser/page_navigator.h" | 20 #include "content/public/browser/page_navigator.h" |
22 #include "content/public/browser/render_process_host.h" | 21 #include "content/public/browser/render_process_host.h" |
23 #include "content/public/browser/resource_dispatcher_host.h" | 22 #include "content/public/browser/resource_dispatcher_host.h" |
24 #include "content/public/browser/storage_partition.h" | 23 #include "content/public/browser/storage_partition.h" |
25 #include "content/public/common/content_switches.h" | 24 #include "content/public/common/content_switches.h" |
26 #include "content/public/common/url_constants.h" | 25 #include "content/public/common/url_constants.h" |
27 #include "content/public/common/web_preferences.h" | 26 #include "content/public/common/web_preferences.h" |
28 #include "content/public/test/test_mojo_app.h" | 27 #include "content/public/test/test_mojo_app.h" |
29 #include "content/shell/browser/shell.h" | 28 #include "content/shell/browser/shell.h" |
30 #include "content/shell/browser/shell_access_token_store.h" | |
31 #include "content/shell/browser/shell_browser_context.h" | 29 #include "content/shell/browser/shell_browser_context.h" |
32 #include "content/shell/browser/shell_browser_main_parts.h" | 30 #include "content/shell/browser/shell_browser_main_parts.h" |
33 #include "content/shell/browser/shell_devtools_manager_delegate.h" | 31 #include "content/shell/browser/shell_devtools_manager_delegate.h" |
34 #include "content/shell/browser/shell_net_log.h" | 32 #include "content/shell/browser/shell_net_log.h" |
35 #include "content/shell/browser/shell_quota_permission_context.h" | 33 #include "content/shell/browser/shell_quota_permission_context.h" |
36 #include "content/shell/browser/shell_resource_dispatcher_host_delegate.h" | 34 #include "content/shell/browser/shell_resource_dispatcher_host_delegate.h" |
37 #include "content/shell/browser/shell_web_contents_view_delegate_creator.h" | 35 #include "content/shell/browser/shell_web_contents_view_delegate_creator.h" |
38 #include "content/shell/common/shell_messages.h" | 36 #include "content/shell/common/shell_messages.h" |
39 #include "content/shell/common/shell_switches.h" | 37 #include "content/shell/common/shell_switches.h" |
40 #include "net/url_request/url_request_context_getter.h" | 38 #include "net/url_request/url_request_context_getter.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 static breakpad::CrashHandlerHostLinux* crash_handler = NULL; | 110 static breakpad::CrashHandlerHostLinux* crash_handler = NULL; |
113 if (!crash_handler) | 111 if (!crash_handler) |
114 crash_handler = CreateCrashHandlerHost(process_type); | 112 crash_handler = CreateCrashHandlerHost(process_type); |
115 return crash_handler->GetDeathSignalSocket(); | 113 return crash_handler->GetDeathSignalSocket(); |
116 } | 114 } |
117 | 115 |
118 return -1; | 116 return -1; |
119 } | 117 } |
120 #endif // defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) | 118 #endif // defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) |
121 | 119 |
122 // A provider of services for Geolocation. | |
123 class ShellGeolocationDelegate : public content::GeolocationDelegate { | |
124 public: | |
125 ShellGeolocationDelegate() {} | |
126 | |
127 scoped_refptr<AccessTokenStore> CreateAccessTokenStore() final { | |
128 return new ShellAccessTokenStore( | |
129 ShellContentBrowserClient::Get()->browser_context()); | |
130 } | |
131 | |
132 private: | |
133 DISALLOW_COPY_AND_ASSIGN(ShellGeolocationDelegate); | |
134 }; | |
135 | |
136 } // namespace | 120 } // namespace |
137 | 121 |
138 ShellContentBrowserClient* ShellContentBrowserClient::Get() { | 122 ShellContentBrowserClient* ShellContentBrowserClient::Get() { |
139 return g_browser_client; | 123 return g_browser_client; |
140 } | 124 } |
141 | 125 |
142 void ShellContentBrowserClient::SetSwapProcessesForRedirect(bool swap) { | 126 void ShellContentBrowserClient::SetSwapProcessesForRedirect(bool swap) { |
143 g_swap_processes_for_redirect = swap; | 127 g_swap_processes_for_redirect = swap; |
144 } | 128 } |
145 | 129 |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 | 341 |
358 ShellBrowserContext* ShellContentBrowserClient::browser_context() { | 342 ShellBrowserContext* ShellContentBrowserClient::browser_context() { |
359 return shell_browser_main_parts_->browser_context(); | 343 return shell_browser_main_parts_->browser_context(); |
360 } | 344 } |
361 | 345 |
362 ShellBrowserContext* | 346 ShellBrowserContext* |
363 ShellContentBrowserClient::off_the_record_browser_context() { | 347 ShellContentBrowserClient::off_the_record_browser_context() { |
364 return shell_browser_main_parts_->off_the_record_browser_context(); | 348 return shell_browser_main_parts_->off_the_record_browser_context(); |
365 } | 349 } |
366 | 350 |
367 GeolocationDelegate* ShellContentBrowserClient::CreateGeolocationDelegate() { | |
368 return new ShellGeolocationDelegate(); | |
369 } | |
370 | |
371 } // namespace content | 351 } // namespace content |
OLD | NEW |