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