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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 | 36 |
37 #if defined(OS_MACOSX) | 37 #if defined(OS_MACOSX) |
38 #include "chrome/browser/extensions/extension_host_mac.h" | 38 #include "chrome/browser/extensions/extension_host_mac.h" |
39 #endif | 39 #endif |
40 | 40 |
41 using content::BrowserThread; | 41 using content::BrowserThread; |
42 using content::OpenURLParams; | 42 using content::OpenURLParams; |
43 using content::Referrer; | 43 using content::Referrer; |
44 using content::RenderViewHost; | 44 using content::RenderViewHost; |
45 using content::SiteInstance; | 45 using content::SiteInstance; |
| 46 using extensions::Extension; |
46 | 47 |
47 namespace { | 48 namespace { |
48 | 49 |
49 std::string GetExtensionID(RenderViewHost* render_view_host) { | 50 std::string GetExtensionID(RenderViewHost* render_view_host) { |
50 // This works for both apps and extensions because the site has been | 51 // This works for both apps and extensions because the site has been |
51 // normalized to the extension URL for apps. | 52 // normalized to the extension URL for apps. |
52 if (!render_view_host->GetSiteInstance()) | 53 if (!render_view_host->GetSiteInstance()) |
53 return ""; | 54 return ""; |
54 | 55 |
55 return render_view_host->GetSiteInstance()->GetSite().host(); | 56 return render_view_host->GetSiteInstance()->GetSite().host(); |
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
533 if (service->is_ready()) { | 534 if (service->is_ready()) { |
534 const Extension* extension = | 535 const Extension* extension = |
535 content::Details<const Extension>(details).ptr(); | 536 content::Details<const Extension>(details).ptr(); |
536 ::CreateBackgroundHostForExtensionLoad(this, extension); | 537 ::CreateBackgroundHostForExtensionLoad(this, extension); |
537 } | 538 } |
538 break; | 539 break; |
539 } | 540 } |
540 | 541 |
541 case chrome::NOTIFICATION_EXTENSION_UNLOADED: { | 542 case chrome::NOTIFICATION_EXTENSION_UNLOADED: { |
542 const Extension* extension = | 543 const Extension* extension = |
543 content::Details<UnloadedExtensionInfo>(details)->extension; | 544 content::Details<extensions::UnloadedExtensionInfo>( |
| 545 details)->extension; |
544 for (ExtensionHostSet::iterator iter = background_hosts_.begin(); | 546 for (ExtensionHostSet::iterator iter = background_hosts_.begin(); |
545 iter != background_hosts_.end(); ++iter) { | 547 iter != background_hosts_.end(); ++iter) { |
546 ExtensionHost* host = *iter; | 548 ExtensionHost* host = *iter; |
547 if (host->extension_id() == extension->id()) { | 549 if (host->extension_id() == extension->id()) { |
548 CloseBackgroundHost(host); | 550 CloseBackgroundHost(host); |
549 break; | 551 break; |
550 } | 552 } |
551 } | 553 } |
552 background_page_data_.erase(extension->id()); | 554 background_page_data_.erase(extension->id()); |
553 break; | 555 break; |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
766 if (service && service->is_ready()) | 768 if (service && service->is_ready()) |
767 CreateBackgroundHostsForProfileStartup(this, service->extensions()); | 769 CreateBackgroundHostsForProfileStartup(this, service->extensions()); |
768 } | 770 } |
769 break; | 771 break; |
770 } | 772 } |
771 default: | 773 default: |
772 ExtensionProcessManager::Observe(type, source, details); | 774 ExtensionProcessManager::Observe(type, source, details); |
773 break; | 775 break; |
774 } | 776 } |
775 } | 777 } |
OLD | NEW |