OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/extensions/extension_service.h" | 5 #include "chrome/browser/extensions/extension_service.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 #include "chrome/browser/ui/browser_list.h" | 79 #include "chrome/browser/ui/browser_list.h" |
80 #include "chrome/browser/ui/global_error_service.h" | 80 #include "chrome/browser/ui/global_error_service.h" |
81 #include "chrome/browser/ui/global_error_service_factory.h" | 81 #include "chrome/browser/ui/global_error_service_factory.h" |
82 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" | 82 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" |
83 #include "chrome/browser/ui/webui/favicon_source.h" | 83 #include "chrome/browser/ui/webui/favicon_source.h" |
84 #include "chrome/browser/ui/webui/ntp/thumbnail_source.h" | 84 #include "chrome/browser/ui/webui/ntp/thumbnail_source.h" |
85 #include "chrome/common/child_process_logging.h" | 85 #include "chrome/common/child_process_logging.h" |
86 #include "chrome/common/chrome_notification_types.h" | 86 #include "chrome/common/chrome_notification_types.h" |
87 #include "chrome/common/chrome_paths.h" | 87 #include "chrome/common/chrome_paths.h" |
88 #include "chrome/common/chrome_switches.h" | 88 #include "chrome/common/chrome_switches.h" |
| 89 #include "chrome/common/chrome_version_info.h" |
89 #include "chrome/common/extensions/extension.h" | 90 #include "chrome/common/extensions/extension.h" |
90 #include "chrome/common/extensions/extension_error_utils.h" | 91 #include "chrome/common/extensions/extension_error_utils.h" |
91 #include "chrome/common/extensions/extension_file_util.h" | 92 #include "chrome/common/extensions/extension_file_util.h" |
92 #include "chrome/common/extensions/extension_manifest_constants.h" | 93 #include "chrome/common/extensions/extension_manifest_constants.h" |
93 #include "chrome/common/extensions/extension_messages.h" | 94 #include "chrome/common/extensions/extension_messages.h" |
94 #include "chrome/common/extensions/extension_resource.h" | 95 #include "chrome/common/extensions/extension_resource.h" |
95 #include "chrome/common/pref_names.h" | 96 #include "chrome/common/pref_names.h" |
96 #include "chrome/common/url_constants.h" | 97 #include "chrome/common/url_constants.h" |
97 #include "content/public/browser/browser_thread.h" | 98 #include "content/public/browser/browser_thread.h" |
98 #include "content/public/browser/devtools_agent_host_registry.h" | 99 #include "content/public/browser/devtools_agent_host_registry.h" |
(...skipping 2334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2433 break; | 2434 break; |
2434 } | 2435 } |
2435 case content::NOTIFICATION_RENDERER_PROCESS_CREATED: { | 2436 case content::NOTIFICATION_RENDERER_PROCESS_CREATED: { |
2436 content::RenderProcessHost* process = | 2437 content::RenderProcessHost* process = |
2437 content::Source<content::RenderProcessHost>(source).ptr(); | 2438 content::Source<content::RenderProcessHost>(source).ptr(); |
2438 Profile* host_profile = | 2439 Profile* host_profile = |
2439 Profile::FromBrowserContext(process->GetBrowserContext()); | 2440 Profile::FromBrowserContext(process->GetBrowserContext()); |
2440 if (!profile_->IsSameProfile(host_profile->GetOriginalProfile())) | 2441 if (!profile_->IsSameProfile(host_profile->GetOriginalProfile())) |
2441 break; | 2442 break; |
2442 | 2443 |
| 2444 // Extensions need to know the channel for API restrictions. |
| 2445 process->Send(new ExtensionMsg_SetChannel( |
| 2446 chrome::VersionInfo::GetChannel())); |
| 2447 |
2443 // Valid extension function names, used to setup bindings in renderer. | 2448 // Valid extension function names, used to setup bindings in renderer. |
2444 std::vector<std::string> function_names; | 2449 std::vector<std::string> function_names; |
2445 ExtensionFunctionDispatcher::GetAllFunctionNames(&function_names); | 2450 ExtensionFunctionDispatcher::GetAllFunctionNames(&function_names); |
2446 process->Send(new ExtensionMsg_SetFunctionNames(function_names)); | 2451 process->Send(new ExtensionMsg_SetFunctionNames(function_names)); |
2447 | 2452 |
2448 // Scripting whitelist. This is modified by tests and must be communicated | 2453 // Scripting whitelist. This is modified by tests and must be communicated |
2449 // to renderers. | 2454 // to renderers. |
2450 process->Send(new ExtensionMsg_SetScriptingWhitelist( | 2455 process->Send(new ExtensionMsg_SetScriptingWhitelist( |
2451 *Extension::GetScriptingWhitelist())); | 2456 *Extension::GetScriptingWhitelist())); |
2452 | 2457 |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2633 // To coexist with certain unit tests that don't have an IO thread message | 2638 // To coexist with certain unit tests that don't have an IO thread message |
2634 // loop available at ExtensionService shutdown, we lazy-initialize this | 2639 // loop available at ExtensionService shutdown, we lazy-initialize this |
2635 // object so that those cases neither create nor destroy an | 2640 // object so that those cases neither create nor destroy an |
2636 // APIResourceController. | 2641 // APIResourceController. |
2637 CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 2642 CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
2638 if (!api_resource_controller_) { | 2643 if (!api_resource_controller_) { |
2639 api_resource_controller_ = new extensions::APIResourceController(); | 2644 api_resource_controller_ = new extensions::APIResourceController(); |
2640 } | 2645 } |
2641 return api_resource_controller_; | 2646 return api_resource_controller_; |
2642 } | 2647 } |
OLD | NEW |