OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/shell/browser/shell_content_browser_client.h" | 5 #include "extensions/shell/browser/shell_content_browser_client.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "content/public/browser/browser_thread.h" | 8 #include "content/public/browser/browser_thread.h" |
9 #include "content/public/browser/render_process_host.h" | 9 #include "content/public/browser/render_process_host.h" |
10 #include "content/public/browser/site_instance.h" | 10 #include "content/public/browser/site_instance.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 #include "content/public/browser/child_process_data.h" | 34 #include "content/public/browser/child_process_data.h" |
35 #endif | 35 #endif |
36 | 36 |
37 using base::CommandLine; | 37 using base::CommandLine; |
38 using content::BrowserContext; | 38 using content::BrowserContext; |
39 using content::BrowserThread; | 39 using content::BrowserThread; |
40 | 40 |
41 namespace extensions { | 41 namespace extensions { |
42 namespace { | 42 namespace { |
43 | 43 |
44 ShellContentBrowserClient* g_instance = NULL; | 44 ShellContentBrowserClient* g_instance = nullptr; |
45 | 45 |
46 } // namespace | 46 } // namespace |
47 | 47 |
48 ShellContentBrowserClient::ShellContentBrowserClient( | 48 ShellContentBrowserClient::ShellContentBrowserClient( |
49 ShellBrowserMainDelegate* browser_main_delegate) | 49 ShellBrowserMainDelegate* browser_main_delegate) |
50 : browser_main_parts_(NULL), browser_main_delegate_(browser_main_delegate) { | 50 : browser_main_parts_(nullptr), |
| 51 browser_main_delegate_(browser_main_delegate) { |
51 DCHECK(!g_instance); | 52 DCHECK(!g_instance); |
52 g_instance = this; | 53 g_instance = this; |
53 } | 54 } |
54 | 55 |
55 ShellContentBrowserClient::~ShellContentBrowserClient() { | 56 ShellContentBrowserClient::~ShellContentBrowserClient() { |
56 g_instance = NULL; | 57 g_instance = nullptr; |
57 } | 58 } |
58 | 59 |
59 // static | 60 // static |
60 ShellContentBrowserClient* ShellContentBrowserClient::Get() { | 61 ShellContentBrowserClient* ShellContentBrowserClient::Get() { |
61 return g_instance; | 62 return g_instance; |
62 } | 63 } |
63 | 64 |
64 content::BrowserContext* ShellContentBrowserClient::GetBrowserContext() { | 65 content::BrowserContext* ShellContentBrowserClient::GetBrowserContext() { |
65 return browser_main_parts_->browser_context(); | 66 return browser_main_parts_->browser_context(); |
66 } | 67 } |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 nacl::NaClProcessHost* host = static_cast<nacl::NaClProcessHost*>( | 201 nacl::NaClProcessHost* host = static_cast<nacl::NaClProcessHost*>( |
201 iter.GetDelegate()); | 202 iter.GetDelegate()); |
202 if (host->process() && | 203 if (host->process() && |
203 host->process()->GetData().id == plugin_process_id) { | 204 host->process()->GetData().id == plugin_process_id) { |
204 // Found the plugin. | 205 // Found the plugin. |
205 return host->browser_ppapi_host(); | 206 return host->browser_ppapi_host(); |
206 } | 207 } |
207 ++iter; | 208 ++iter; |
208 } | 209 } |
209 #endif | 210 #endif |
210 return NULL; | 211 return nullptr; |
211 } | 212 } |
212 | 213 |
213 void ShellContentBrowserClient::GetAdditionalAllowedSchemesForFileSystem( | 214 void ShellContentBrowserClient::GetAdditionalAllowedSchemesForFileSystem( |
214 std::vector<std::string>* additional_allowed_schemes) { | 215 std::vector<std::string>* additional_allowed_schemes) { |
215 ContentBrowserClient::GetAdditionalAllowedSchemesForFileSystem( | 216 ContentBrowserClient::GetAdditionalAllowedSchemesForFileSystem( |
216 additional_allowed_schemes); | 217 additional_allowed_schemes); |
217 additional_allowed_schemes->push_back(kExtensionScheme); | 218 additional_allowed_schemes->push_back(kExtensionScheme); |
218 } | 219 } |
219 | 220 |
220 void ShellContentBrowserClient::AppendRendererSwitches( | 221 void ShellContentBrowserClient::AppendRendererSwitches( |
(...skipping 17 matching lines...) Expand all Loading... |
238 | 239 |
239 const Extension* ShellContentBrowserClient::GetExtension( | 240 const Extension* ShellContentBrowserClient::GetExtension( |
240 content::SiteInstance* site_instance) { | 241 content::SiteInstance* site_instance) { |
241 ExtensionRegistry* registry = | 242 ExtensionRegistry* registry = |
242 ExtensionRegistry::Get(site_instance->GetBrowserContext()); | 243 ExtensionRegistry::Get(site_instance->GetBrowserContext()); |
243 return registry->enabled_extensions().GetExtensionOrAppByURL( | 244 return registry->enabled_extensions().GetExtensionOrAppByURL( |
244 site_instance->GetSiteURL()); | 245 site_instance->GetSiteURL()); |
245 } | 246 } |
246 | 247 |
247 } // namespace extensions | 248 } // namespace extensions |
OLD | NEW |