| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 904 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 915 content::Source<Profile>(profile_), | 915 content::Source<Profile>(profile_), |
| 916 content::Details<const Extension>(extension)); | 916 content::Details<const Extension>(extension)); |
| 917 | 917 |
| 918 // Tell renderers about the new extension. | 918 // Tell renderers about the new extension. |
| 919 for (RenderProcessHost::iterator i(RenderProcessHost::AllHostsIterator()); | 919 for (RenderProcessHost::iterator i(RenderProcessHost::AllHostsIterator()); |
| 920 !i.IsAtEnd(); i.Advance()) { | 920 !i.IsAtEnd(); i.Advance()) { |
| 921 RenderProcessHost* host = i.GetCurrentValue(); | 921 RenderProcessHost* host = i.GetCurrentValue(); |
| 922 Profile* host_profile = | 922 Profile* host_profile = |
| 923 Profile::FromBrowserContext(host->browser_context()); | 923 Profile::FromBrowserContext(host->browser_context()); |
| 924 if (host_profile->GetOriginalProfile() == profile_->GetOriginalProfile()) { | 924 if (host_profile->GetOriginalProfile() == profile_->GetOriginalProfile()) { |
| 925 std::vector<ExtensionMsg_Loaded_Params> loaded_extensions( |
| 926 1, ExtensionMsg_Loaded_Params(extension)); |
| 925 host->Send( | 927 host->Send( |
| 926 new ExtensionMsg_Loaded(ExtensionMsg_Loaded_Params(extension))); | 928 new ExtensionMsg_Loaded(loaded_extensions)); |
| 927 } | 929 } |
| 928 } | 930 } |
| 929 | 931 |
| 930 // Tell a random-ass collection of other subsystems about the new extension. | 932 // Tell a random-ass collection of other subsystems about the new extension. |
| 931 // TODO(aa): What should we do with all this goop? Can it move into the | 933 // TODO(aa): What should we do with all this goop? Can it move into the |
| 932 // relevant objects via EXTENSION_LOADED? | 934 // relevant objects via EXTENSION_LOADED? |
| 933 | 935 |
| 934 profile_->GetExtensionSpecialStoragePolicy()-> | 936 profile_->GetExtensionSpecialStoragePolicy()-> |
| 935 GrantRightsForExtension(extension); | 937 GrantRightsForExtension(extension); |
| 936 | 938 |
| (...skipping 1381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2318 std::vector<std::string> function_names; | 2320 std::vector<std::string> function_names; |
| 2319 ExtensionFunctionDispatcher::GetAllFunctionNames(&function_names); | 2321 ExtensionFunctionDispatcher::GetAllFunctionNames(&function_names); |
| 2320 process->Send(new ExtensionMsg_SetFunctionNames(function_names)); | 2322 process->Send(new ExtensionMsg_SetFunctionNames(function_names)); |
| 2321 | 2323 |
| 2322 // Scripting whitelist. This is modified by tests and must be communicated | 2324 // Scripting whitelist. This is modified by tests and must be communicated |
| 2323 // to renderers. | 2325 // to renderers. |
| 2324 process->Send(new ExtensionMsg_SetScriptingWhitelist( | 2326 process->Send(new ExtensionMsg_SetScriptingWhitelist( |
| 2325 *Extension::GetScriptingWhitelist())); | 2327 *Extension::GetScriptingWhitelist())); |
| 2326 | 2328 |
| 2327 // Loaded extensions. | 2329 // Loaded extensions. |
| 2330 std::vector<ExtensionMsg_Loaded_Params> loaded_extensions; |
| 2328 for (size_t i = 0; i < extensions_.size(); ++i) { | 2331 for (size_t i = 0; i < extensions_.size(); ++i) { |
| 2329 process->Send(new ExtensionMsg_Loaded( | 2332 loaded_extensions.push_back( |
| 2330 ExtensionMsg_Loaded_Params(extensions_[i]))); | 2333 ExtensionMsg_Loaded_Params(extensions_[i])); |
| 2331 } | 2334 } |
| 2335 process->Send(new ExtensionMsg_Loaded(loaded_extensions)); |
| 2332 break; | 2336 break; |
| 2333 } | 2337 } |
| 2334 case content::NOTIFICATION_RENDERER_PROCESS_TERMINATED: { | 2338 case content::NOTIFICATION_RENDERER_PROCESS_TERMINATED: { |
| 2335 RenderProcessHost* process = | 2339 RenderProcessHost* process = |
| 2336 content::Source<RenderProcessHost>(source).ptr(); | 2340 content::Source<RenderProcessHost>(source).ptr(); |
| 2337 Profile* host_profile = | 2341 Profile* host_profile = |
| 2338 Profile::FromBrowserContext(process->browser_context()); | 2342 Profile::FromBrowserContext(process->browser_context()); |
| 2339 if (!profile_->IsSameProfile(host_profile->GetOriginalProfile())) | 2343 if (!profile_->IsSameProfile(host_profile->GetOriginalProfile())) |
| 2340 break; | 2344 break; |
| 2341 | 2345 |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2491 | 2495 |
| 2492 ExtensionService::NaClModuleInfoList::iterator | 2496 ExtensionService::NaClModuleInfoList::iterator |
| 2493 ExtensionService::FindNaClModule(const GURL& url) { | 2497 ExtensionService::FindNaClModule(const GURL& url) { |
| 2494 for (NaClModuleInfoList::iterator iter = nacl_module_list_.begin(); | 2498 for (NaClModuleInfoList::iterator iter = nacl_module_list_.begin(); |
| 2495 iter != nacl_module_list_.end(); ++iter) { | 2499 iter != nacl_module_list_.end(); ++iter) { |
| 2496 if (iter->url == url) | 2500 if (iter->url == url) |
| 2497 return iter; | 2501 return iter; |
| 2498 } | 2502 } |
| 2499 return nacl_module_list_.end(); | 2503 return nacl_module_list_.end(); |
| 2500 } | 2504 } |
| OLD | NEW |