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 1335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1346 // extension. | 1346 // extension. |
1347 NotificationService::current()->Notify( | 1347 NotificationService::current()->Notify( |
1348 chrome::NOTIFICATION_EXTENSION_LOADED, | 1348 chrome::NOTIFICATION_EXTENSION_LOADED, |
1349 Source<Profile>(profile_), | 1349 Source<Profile>(profile_), |
1350 Details<const Extension>(extension)); | 1350 Details<const Extension>(extension)); |
1351 | 1351 |
1352 // Tell renderers about the new extension. | 1352 // Tell renderers about the new extension. |
1353 for (RenderProcessHost::iterator i(RenderProcessHost::AllHostsIterator()); | 1353 for (RenderProcessHost::iterator i(RenderProcessHost::AllHostsIterator()); |
1354 !i.IsAtEnd(); i.Advance()) { | 1354 !i.IsAtEnd(); i.Advance()) { |
1355 RenderProcessHost* host = i.GetCurrentValue(); | 1355 RenderProcessHost* host = i.GetCurrentValue(); |
1356 if (host->profile()->GetOriginalProfile() == | 1356 Profile* host_profile = |
1357 profile_->GetOriginalProfile()) { | 1357 Profile::FromBrowserContext(host->browser_context()); |
| 1358 if (host_profile->GetOriginalProfile() == profile_->GetOriginalProfile()) { |
1358 host->Send( | 1359 host->Send( |
1359 new ExtensionMsg_Loaded(ExtensionMsg_Loaded_Params(extension))); | 1360 new ExtensionMsg_Loaded(ExtensionMsg_Loaded_Params(extension))); |
1360 } | 1361 } |
1361 } | 1362 } |
1362 | 1363 |
1363 // Tell a random-ass collection of other subsystems about the new extension. | 1364 // Tell a random-ass collection of other subsystems about the new extension. |
1364 // TODO(aa): What should we do with all this goop? Can it move into the | 1365 // TODO(aa): What should we do with all this goop? Can it move into the |
1365 // relevant objects via EXTENSION_LOADED? | 1366 // relevant objects via EXTENSION_LOADED? |
1366 | 1367 |
1367 profile_->GetExtensionSpecialStoragePolicy()-> | 1368 profile_->GetExtensionSpecialStoragePolicy()-> |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1442 const Extension* extension, UnloadedExtensionInfo::Reason reason) { | 1443 const Extension* extension, UnloadedExtensionInfo::Reason reason) { |
1443 UnloadedExtensionInfo details(extension, reason); | 1444 UnloadedExtensionInfo details(extension, reason); |
1444 NotificationService::current()->Notify( | 1445 NotificationService::current()->Notify( |
1445 chrome::NOTIFICATION_EXTENSION_UNLOADED, | 1446 chrome::NOTIFICATION_EXTENSION_UNLOADED, |
1446 Source<Profile>(profile_), | 1447 Source<Profile>(profile_), |
1447 Details<UnloadedExtensionInfo>(&details)); | 1448 Details<UnloadedExtensionInfo>(&details)); |
1448 | 1449 |
1449 for (RenderProcessHost::iterator i(RenderProcessHost::AllHostsIterator()); | 1450 for (RenderProcessHost::iterator i(RenderProcessHost::AllHostsIterator()); |
1450 !i.IsAtEnd(); i.Advance()) { | 1451 !i.IsAtEnd(); i.Advance()) { |
1451 RenderProcessHost* host = i.GetCurrentValue(); | 1452 RenderProcessHost* host = i.GetCurrentValue(); |
1452 if (host->profile()->GetOriginalProfile() == | 1453 Profile* host_profile = |
1453 profile_->GetOriginalProfile()) { | 1454 Profile::FromBrowserContext(host->browser_context()); |
| 1455 if (host_profile->GetOriginalProfile() == profile_->GetOriginalProfile()) |
1454 host->Send(new ExtensionMsg_Unloaded(extension->id())); | 1456 host->Send(new ExtensionMsg_Unloaded(extension->id())); |
1455 } | |
1456 } | 1457 } |
1457 | 1458 |
1458 profile_->UnregisterExtensionWithRequestContexts(extension->id(), reason); | 1459 profile_->UnregisterExtensionWithRequestContexts(extension->id(), reason); |
1459 profile_->GetExtensionSpecialStoragePolicy()-> | 1460 profile_->GetExtensionSpecialStoragePolicy()-> |
1460 RevokeRightsForExtension(extension); | 1461 RevokeRightsForExtension(extension); |
1461 | 1462 |
1462 ExtensionWebUI::UnregisterChromeURLOverrides( | 1463 ExtensionWebUI::UnregisterChromeURLOverrides( |
1463 profile_, extension->GetChromeURLOverrides()); | 1464 profile_, extension->GetChromeURLOverrides()); |
1464 | 1465 |
1465 #if defined(OS_CHROMEOS) | 1466 #if defined(OS_CHROMEOS) |
(...skipping 1053 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2519 | 2520 |
2520 ExtensionService::NaClModuleInfoList::iterator | 2521 ExtensionService::NaClModuleInfoList::iterator |
2521 ExtensionService::FindNaClModule(const GURL& url) { | 2522 ExtensionService::FindNaClModule(const GURL& url) { |
2522 for (NaClModuleInfoList::iterator iter = nacl_module_list_.begin(); | 2523 for (NaClModuleInfoList::iterator iter = nacl_module_list_.begin(); |
2523 iter != nacl_module_list_.end(); ++iter) { | 2524 iter != nacl_module_list_.end(); ++iter) { |
2524 if (iter->url == url) | 2525 if (iter->url == url) |
2525 return iter; | 2526 return iter; |
2526 } | 2527 } |
2527 return nacl_module_list_.end(); | 2528 return nacl_module_list_.end(); |
2528 } | 2529 } |
OLD | NEW |