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

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

Issue 8515027: Define the public version of the browser side RenderProcessHost interface. This interface is not ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 1 month 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
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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 #include "chrome/common/extensions/extension_constants.h" 80 #include "chrome/common/extensions/extension_constants.h"
81 #include "chrome/common/extensions/extension_error_utils.h" 81 #include "chrome/common/extensions/extension_error_utils.h"
82 #include "chrome/common/extensions/extension_file_util.h" 82 #include "chrome/common/extensions/extension_file_util.h"
83 #include "chrome/common/extensions/extension_messages.h" 83 #include "chrome/common/extensions/extension_messages.h"
84 #include "chrome/common/extensions/extension_resource.h" 84 #include "chrome/common/extensions/extension_resource.h"
85 #include "chrome/common/pref_names.h" 85 #include "chrome/common/pref_names.h"
86 #include "chrome/common/url_constants.h" 86 #include "chrome/common/url_constants.h"
87 #include "content/browser/debugger/devtools_manager.h" 87 #include "content/browser/debugger/devtools_manager.h"
88 #include "content/browser/plugin_process_host.h" 88 #include "content/browser/plugin_process_host.h"
89 #include "content/browser/plugin_service.h" 89 #include "content/browser/plugin_service.h"
90 #include "content/browser/renderer_host/render_process_host.h"
91 #include "content/browser/user_metrics.h" 90 #include "content/browser/user_metrics.h"
92 #include "content/common/pepper_plugin_registry.h" 91 #include "content/common/pepper_plugin_registry.h"
93 #include "content/public/browser/browser_thread.h" 92 #include "content/public/browser/browser_thread.h"
94 #include "content/public/browser/notification_service.h" 93 #include "content/public/browser/notification_service.h"
95 #include "content/public/browser/notification_types.h" 94 #include "content/public/browser/notification_types.h"
95 #include "content/public/browser/render_process_host.h"
96 #include "googleurl/src/gurl.h" 96 #include "googleurl/src/gurl.h"
97 #include "net/base/registry_controlled_domain.h" 97 #include "net/base/registry_controlled_domain.h"
98 #include "webkit/database/database_tracker.h" 98 #include "webkit/database/database_tracker.h"
99 #include "webkit/database/database_util.h" 99 #include "webkit/database/database_util.h"
100 100
101 #if defined(OS_CHROMEOS) 101 #if defined(OS_CHROMEOS)
102 #include "chrome/browser/chromeos/cros/cros_library.h" 102 #include "chrome/browser/chromeos/cros/cros_library.h"
103 #include "chrome/browser/chromeos/extensions/file_browser_event_router.h" 103 #include "chrome/browser/chromeos/extensions/file_browser_event_router.h"
104 #include "chrome/browser/chromeos/extensions/input_method_event_router.h" 104 #include "chrome/browser/chromeos/extensions/input_method_event_router.h"
105 #include "chrome/browser/chromeos/extensions/media_player_event_router.h" 105 #include "chrome/browser/chromeos/extensions/media_player_event_router.h"
(...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after
913 content::NotificationService::current()->Notify( 913 content::NotificationService::current()->Notify(
914 chrome::NOTIFICATION_EXTENSION_LOADED, 914 chrome::NOTIFICATION_EXTENSION_LOADED,
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->GetBrowserContext());
924 if (host_profile->GetOriginalProfile() == profile_->GetOriginalProfile()) { 924 if (host_profile->GetOriginalProfile() == profile_->GetOriginalProfile()) {
925 std::vector<ExtensionMsg_Loaded_Params> loaded_extensions( 925 std::vector<ExtensionMsg_Loaded_Params> loaded_extensions(
926 1, ExtensionMsg_Loaded_Params(extension)); 926 1, ExtensionMsg_Loaded_Params(extension));
927 host->Send( 927 host->Send(
928 new ExtensionMsg_Loaded(loaded_extensions)); 928 new ExtensionMsg_Loaded(loaded_extensions));
929 } 929 }
930 } 930 }
931 931
932 // 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.
933 // 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
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
1033 UnloadedExtensionInfo details(extension, reason); 1033 UnloadedExtensionInfo details(extension, reason);
1034 content::NotificationService::current()->Notify( 1034 content::NotificationService::current()->Notify(
1035 chrome::NOTIFICATION_EXTENSION_UNLOADED, 1035 chrome::NOTIFICATION_EXTENSION_UNLOADED,
1036 content::Source<Profile>(profile_), 1036 content::Source<Profile>(profile_),
1037 content::Details<UnloadedExtensionInfo>(&details)); 1037 content::Details<UnloadedExtensionInfo>(&details));
1038 1038
1039 for (RenderProcessHost::iterator i(RenderProcessHost::AllHostsIterator()); 1039 for (RenderProcessHost::iterator i(RenderProcessHost::AllHostsIterator());
1040 !i.IsAtEnd(); i.Advance()) { 1040 !i.IsAtEnd(); i.Advance()) {
1041 RenderProcessHost* host = i.GetCurrentValue(); 1041 RenderProcessHost* host = i.GetCurrentValue();
1042 Profile* host_profile = 1042 Profile* host_profile =
1043 Profile::FromBrowserContext(host->browser_context()); 1043 Profile::FromBrowserContext(host->GetBrowserContext());
1044 if (host_profile->GetOriginalProfile() == profile_->GetOriginalProfile()) 1044 if (host_profile->GetOriginalProfile() == profile_->GetOriginalProfile())
1045 host->Send(new ExtensionMsg_Unloaded(extension->id())); 1045 host->Send(new ExtensionMsg_Unloaded(extension->id()));
1046 } 1046 }
1047 1047
1048 profile_->UnregisterExtensionWithRequestContexts(extension->id(), reason); 1048 profile_->UnregisterExtensionWithRequestContexts(extension->id(), reason);
1049 profile_->GetExtensionSpecialStoragePolicy()-> 1049 profile_->GetExtensionSpecialStoragePolicy()->
1050 RevokeRightsForExtension(extension); 1050 RevokeRightsForExtension(extension);
1051 1051
1052 ExtensionWebUI::UnregisterChromeURLOverrides( 1052 ExtensionWebUI::UnregisterChromeURLOverrides(
1053 profile_, extension->GetChromeURLOverrides()); 1053 profile_, extension->GetChromeURLOverrides());
(...skipping 1258 matching lines...) Expand 10 before | Expand all | Expand 10 after
2312 base::Bind( 2312 base::Bind(
2313 &ExtensionService::TrackTerminatedExtension, 2313 &ExtensionService::TrackTerminatedExtension,
2314 AsWeakPtr(), 2314 AsWeakPtr(),
2315 host->extension())); 2315 host->extension()));
2316 break; 2316 break;
2317 } 2317 }
2318 case content::NOTIFICATION_RENDERER_PROCESS_CREATED: { 2318 case content::NOTIFICATION_RENDERER_PROCESS_CREATED: {
2319 RenderProcessHost* process = 2319 RenderProcessHost* process =
2320 content::Source<RenderProcessHost>(source).ptr(); 2320 content::Source<RenderProcessHost>(source).ptr();
2321 Profile* host_profile = 2321 Profile* host_profile =
2322 Profile::FromBrowserContext(process->browser_context()); 2322 Profile::FromBrowserContext(process->GetBrowserContext());
2323 if (!profile_->IsSameProfile(host_profile->GetOriginalProfile())) 2323 if (!profile_->IsSameProfile(host_profile->GetOriginalProfile()))
2324 break; 2324 break;
2325 2325
2326 // Valid extension function names, used to setup bindings in renderer. 2326 // Valid extension function names, used to setup bindings in renderer.
2327 std::vector<std::string> function_names; 2327 std::vector<std::string> function_names;
2328 ExtensionFunctionDispatcher::GetAllFunctionNames(&function_names); 2328 ExtensionFunctionDispatcher::GetAllFunctionNames(&function_names);
2329 process->Send(new ExtensionMsg_SetFunctionNames(function_names)); 2329 process->Send(new ExtensionMsg_SetFunctionNames(function_names));
2330 2330
2331 // Scripting whitelist. This is modified by tests and must be communicated 2331 // Scripting whitelist. This is modified by tests and must be communicated
2332 // to renderers. 2332 // to renderers.
2333 process->Send(new ExtensionMsg_SetScriptingWhitelist( 2333 process->Send(new ExtensionMsg_SetScriptingWhitelist(
2334 *Extension::GetScriptingWhitelist())); 2334 *Extension::GetScriptingWhitelist()));
2335 2335
2336 // Loaded extensions. 2336 // Loaded extensions.
2337 std::vector<ExtensionMsg_Loaded_Params> loaded_extensions; 2337 std::vector<ExtensionMsg_Loaded_Params> loaded_extensions;
2338 for (size_t i = 0; i < extensions_.size(); ++i) { 2338 for (size_t i = 0; i < extensions_.size(); ++i) {
2339 loaded_extensions.push_back( 2339 loaded_extensions.push_back(
2340 ExtensionMsg_Loaded_Params(extensions_[i])); 2340 ExtensionMsg_Loaded_Params(extensions_[i]));
2341 } 2341 }
2342 process->Send(new ExtensionMsg_Loaded(loaded_extensions)); 2342 process->Send(new ExtensionMsg_Loaded(loaded_extensions));
2343 break; 2343 break;
2344 } 2344 }
2345 case content::NOTIFICATION_RENDERER_PROCESS_TERMINATED: { 2345 case content::NOTIFICATION_RENDERER_PROCESS_TERMINATED: {
2346 RenderProcessHost* process = 2346 RenderProcessHost* process =
2347 content::Source<RenderProcessHost>(source).ptr(); 2347 content::Source<RenderProcessHost>(source).ptr();
2348 Profile* host_profile = 2348 Profile* host_profile =
2349 Profile::FromBrowserContext(process->browser_context()); 2349 Profile::FromBrowserContext(process->GetBrowserContext());
2350 if (!profile_->IsSameProfile(host_profile->GetOriginalProfile())) 2350 if (!profile_->IsSameProfile(host_profile->GetOriginalProfile()))
2351 break; 2351 break;
2352 2352
2353 installed_app_hosts_.erase(process->id()); 2353 installed_app_hosts_.erase(process->GetID());
2354 2354
2355 process_map_.Remove(process->id()); 2355 process_map_.Remove(process->GetID());
2356 BrowserThread::PostTask( 2356 BrowserThread::PostTask(
2357 BrowserThread::IO, FROM_HERE, 2357 BrowserThread::IO, FROM_HERE,
2358 base::Bind(&ExtensionInfoMap::UnregisterAllExtensionsInProcess, 2358 base::Bind(&ExtensionInfoMap::UnregisterAllExtensionsInProcess,
2359 profile_->GetExtensionInfoMap(), 2359 profile_->GetExtensionInfoMap(),
2360 process->id())); 2360 process->GetID()));
2361 break; 2361 break;
2362 } 2362 }
2363 case chrome::NOTIFICATION_PREF_CHANGED: { 2363 case chrome::NOTIFICATION_PREF_CHANGED: {
2364 std::string* pref_name = content::Details<std::string>(details).ptr(); 2364 std::string* pref_name = content::Details<std::string>(details).ptr();
2365 if (*pref_name == prefs::kExtensionInstallAllowList || 2365 if (*pref_name == prefs::kExtensionInstallAllowList ||
2366 *pref_name == prefs::kExtensionInstallDenyList) { 2366 *pref_name == prefs::kExtensionInstallDenyList) {
2367 CheckAdminBlacklist(); 2367 CheckAdminBlacklist();
2368 } else { 2368 } else {
2369 NOTREACHED() << "Unexpected preference name."; 2369 NOTREACHED() << "Unexpected preference name.";
2370 } 2370 }
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
2502 2502
2503 ExtensionService::NaClModuleInfoList::iterator 2503 ExtensionService::NaClModuleInfoList::iterator
2504 ExtensionService::FindNaClModule(const GURL& url) { 2504 ExtensionService::FindNaClModule(const GURL& url) {
2505 for (NaClModuleInfoList::iterator iter = nacl_module_list_.begin(); 2505 for (NaClModuleInfoList::iterator iter = nacl_module_list_.begin();
2506 iter != nacl_module_list_.end(); ++iter) { 2506 iter != nacl_module_list_.end(); ++iter) {
2507 if (iter->url == url) 2507 if (iter->url == url)
2508 return iter; 2508 return iter;
2509 } 2509 }
2510 return nacl_module_list_.end(); 2510 return nacl_module_list_.end();
2511 } 2511 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698