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

Side by Side Diff: chrome/browser/extensions/extension_service.cc

Issue 8976003: Extensions: send the whole manifest to the extensions process in (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: don't send themes Created 9 years 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/common/extensions/extension_messages.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 913 matching lines...) Expand 10 before | Expand all | Expand 10 after
924 // extension. 924 // extension.
925 profile_->RegisterExtensionWithRequestContexts(extension); 925 profile_->RegisterExtensionWithRequestContexts(extension);
926 926
927 // Tell subsystems that use the EXTENSION_LOADED notification about the new 927 // Tell subsystems that use the EXTENSION_LOADED notification about the new
928 // extension. 928 // extension.
929 content::NotificationService::current()->Notify( 929 content::NotificationService::current()->Notify(
930 chrome::NOTIFICATION_EXTENSION_LOADED, 930 chrome::NOTIFICATION_EXTENSION_LOADED,
931 content::Source<Profile>(profile_), 931 content::Source<Profile>(profile_),
932 content::Details<const Extension>(extension)); 932 content::Details<const Extension>(extension));
933 933
934 // Tell renderers about the new extension. 934 // Tell renderers about the new extension, unless it's a theme (renderers
935 for (content::RenderProcessHost::iterator i( 935 // don't need to know about themes).
936 content::RenderProcessHost::AllHostsIterator()); 936 if (!extension->is_theme()) {
937 !i.IsAtEnd(); i.Advance()) { 937 for (content::RenderProcessHost::iterator i(
938 content::RenderProcessHost* host = i.GetCurrentValue(); 938 content::RenderProcessHost::AllHostsIterator());
939 Profile* host_profile = 939 !i.IsAtEnd(); i.Advance()) {
940 Profile::FromBrowserContext(host->GetBrowserContext()); 940 content::RenderProcessHost* host = i.GetCurrentValue();
941 if (host_profile->GetOriginalProfile() == profile_->GetOriginalProfile()) { 941 Profile* host_profile =
942 std::vector<ExtensionMsg_Loaded_Params> loaded_extensions( 942 Profile::FromBrowserContext(host->GetBrowserContext());
943 1, ExtensionMsg_Loaded_Params(extension)); 943 if (host_profile->GetOriginalProfile() ==
944 host->Send( 944 profile_->GetOriginalProfile()) {
945 new ExtensionMsg_Loaded(loaded_extensions)); 945 std::vector<ExtensionMsg_Loaded_Params> loaded_extensions(
946 1, ExtensionMsg_Loaded_Params(extension));
947 host->Send(
948 new ExtensionMsg_Loaded(loaded_extensions));
949 }
946 } 950 }
947 } 951 }
948 952
949 // Tell a random-ass collection of other subsystems about the new extension. 953 // Tell a random-ass collection of other subsystems about the new extension.
950 // TODO(aa): What should we do with all this goop? Can it move into the 954 // TODO(aa): What should we do with all this goop? Can it move into the
951 // relevant objects via EXTENSION_LOADED? 955 // relevant objects via EXTENSION_LOADED?
952 956
953 profile_->GetExtensionSpecialStoragePolicy()-> 957 profile_->GetExtensionSpecialStoragePolicy()->
954 GrantRightsForExtension(extension); 958 GrantRightsForExtension(extension);
955 959
(...skipping 1364 matching lines...) Expand 10 before | Expand all | Expand 10 after
2320 2324
2321 // Scripting whitelist. This is modified by tests and must be communicated 2325 // Scripting whitelist. This is modified by tests and must be communicated
2322 // to renderers. 2326 // to renderers.
2323 process->Send(new ExtensionMsg_SetScriptingWhitelist( 2327 process->Send(new ExtensionMsg_SetScriptingWhitelist(
2324 *Extension::GetScriptingWhitelist())); 2328 *Extension::GetScriptingWhitelist()));
2325 2329
2326 // Loaded extensions. 2330 // Loaded extensions.
2327 std::vector<ExtensionMsg_Loaded_Params> loaded_extensions; 2331 std::vector<ExtensionMsg_Loaded_Params> loaded_extensions;
2328 for (ExtensionSet::const_iterator iter = extensions_.begin(); 2332 for (ExtensionSet::const_iterator iter = extensions_.begin();
2329 iter != extensions_.end(); ++iter) { 2333 iter != extensions_.end(); ++iter) {
2330 loaded_extensions.push_back(ExtensionMsg_Loaded_Params(*iter)); 2334 // Renderers don't need to know about themes.
2335 if (!(*iter)->is_theme())
2336 loaded_extensions.push_back(ExtensionMsg_Loaded_Params(*iter));
2331 } 2337 }
2332 process->Send(new ExtensionMsg_Loaded(loaded_extensions)); 2338 process->Send(new ExtensionMsg_Loaded(loaded_extensions));
2333 break; 2339 break;
2334 } 2340 }
2335 case content::NOTIFICATION_RENDERER_PROCESS_TERMINATED: { 2341 case content::NOTIFICATION_RENDERER_PROCESS_TERMINATED: {
2336 content::RenderProcessHost* process = 2342 content::RenderProcessHost* process =
2337 content::Source<content::RenderProcessHost>(source).ptr(); 2343 content::Source<content::RenderProcessHost>(source).ptr();
2338 Profile* host_profile = 2344 Profile* host_profile =
2339 Profile::FromBrowserContext(process->GetBrowserContext()); 2345 Profile::FromBrowserContext(process->GetBrowserContext());
2340 if (!profile_->IsSameProfile(host_profile->GetOriginalProfile())) 2346 if (!profile_->IsSameProfile(host_profile->GetOriginalProfile()))
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
2557 // 2563 //
2558 // To coexist with certain unit tests that don't have an IO thread message 2564 // To coexist with certain unit tests that don't have an IO thread message
2559 // loop available at ExtensionService shutdown, we lazy-initialize this 2565 // loop available at ExtensionService shutdown, we lazy-initialize this
2560 // object so that those cases neither create nor destroy a SocketController. 2566 // object so that those cases neither create nor destroy a SocketController.
2561 CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 2567 CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
2562 if (!socket_controller_) { 2568 if (!socket_controller_) {
2563 socket_controller_ = new extensions::SocketController(); 2569 socket_controller_ = new extensions::SocketController();
2564 } 2570 }
2565 return socket_controller_; 2571 return socket_controller_;
2566 } 2572 }
OLDNEW
« no previous file with comments | « no previous file | chrome/common/extensions/extension_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698