diff options
Diffstat (limited to 'chrome/browser/extensions')
7 files changed, 3 insertions, 69 deletions
diff --git a/chrome/browser/extensions/extension_browser_event_router.cc b/chrome/browser/extensions/extension_browser_event_router.cc index c7a5b33..3bd807a 100644 --- a/chrome/browser/extensions/extension_browser_event_router.cc +++ b/chrome/browser/extensions/extension_browser_event_router.cc @@ -329,7 +329,6 @@ void ExtensionBrowserEventRouter::TabChangedAt(TabContents* contents, void ExtensionBrowserEventRouter::TabStripEmpty() { } void ExtensionBrowserEventRouter::PageActionExecuted(Profile* profile, - std::string extension_id, std::string page_action_id, int tab_id, std::string url) { @@ -347,6 +346,5 @@ void ExtensionBrowserEventRouter::PageActionExecuted(Profile* profile, std::string json_args; JSONWriter::Write(&args, false, &json_args); - std::string event_name = extension_id + std::string("/") + page_action_id; - DispatchEvent(profile, event_name.c_str(), json_args); + DispatchEvent(profile, events::kOnPageActionExecuted, json_args); } diff --git a/chrome/browser/extensions/extension_browser_event_router.h b/chrome/browser/extensions/extension_browser_event_router.h index d2f7613..0cfd075 100644 --- a/chrome/browser/extensions/extension_browser_event_router.h +++ b/chrome/browser/extensions/extension_browser_event_router.h @@ -50,7 +50,6 @@ class ExtensionBrowserEventRouter : public TabStripModelObserver, // PageActions. void PageActionExecuted(Profile* profile, - std::string extension_id, std::string page_action_id, int tab_id, std::string url); diff --git a/chrome/browser/extensions/extension_event_names.cc b/chrome/browser/extensions/extension_event_names.cc index 214d37b..f4fd6e7 100644 --- a/chrome/browser/extensions/extension_event_names.cc +++ b/chrome/browser/extensions/extension_event_names.cc @@ -6,6 +6,7 @@ namespace extension_event_names { +const char kOnPageActionExecuted[] = "page-action-executed"; const char kOnTabAttached[] = "tab-attached"; const char kOnTabCreated[] = "tab-created"; const char kOnTabDetached[] = "tab-detached"; diff --git a/chrome/browser/extensions/extension_event_names.h b/chrome/browser/extensions/extension_event_names.h index 3e3673a..9b9e3f2 100644 --- a/chrome/browser/extensions/extension_event_names.h +++ b/chrome/browser/extensions/extension_event_names.h @@ -9,6 +9,7 @@ namespace extension_event_names { +extern const char kOnPageActionExecuted[]; extern const char kOnTabAttached[]; extern const char kOnTabCreated[]; extern const char kOnTabDetached[]; diff --git a/chrome/browser/extensions/extension_function_dispatcher.cc b/chrome/browser/extensions/extension_function_dispatcher.cc index 43aca30..8238595 100644 --- a/chrome/browser/extensions/extension_function_dispatcher.cc +++ b/chrome/browser/extensions/extension_function_dispatcher.cc @@ -13,7 +13,6 @@ #include "chrome/browser/extensions/extension_message_service.h" #include "chrome/browser/extensions/extension_page_actions_module.h" #include "chrome/browser/extensions/extension_page_actions_module_constants.h" -#include "chrome/browser/extensions/extension_process_manager.h" #include "chrome/browser/extensions/extension_tabs_module.h" #include "chrome/browser/extensions/extension_tabs_module_constants.h" #include "chrome/browser/profile.h" @@ -189,11 +188,6 @@ ExtensionFunctionDispatcher::ExtensionFunctionDispatcher( // Ensure the message service is initialized. ExtensionMessageService::GetInstance(profile()->GetRequestContext())->Init(); - - // Notify the ExtensionProcessManager that the view was created. - ExtensionProcessManager* epm = profile()->GetExtensionProcessManager(); - epm->RegisterExtensionProcess(extension_id(), - render_view_host->process()->pid()); } ExtensionFunctionDispatcher::~ExtensionFunctionDispatcher() { diff --git a/chrome/browser/extensions/extension_process_manager.cc b/chrome/browser/extensions/extension_process_manager.cc index 3018ea8..4c2047b 100644 --- a/chrome/browser/extensions/extension_process_manager.cc +++ b/chrome/browser/extensions/extension_process_manager.cc @@ -9,11 +9,9 @@ #include "chrome/browser/extensions/extensions_service.h" #include "chrome/browser/profile.h" #include "chrome/browser/renderer_host/site_instance.h" -#include "chrome/browser/renderer_host/render_view_host.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/notification_service.h" #include "chrome/common/notification_type.h" -#include "chrome/common/render_messages.h" static void CreateBackgroundHosts( ExtensionProcessManager* manager, const ExtensionList* extensions) { @@ -35,10 +33,6 @@ ExtensionProcessManager::ExtensionProcessManager(Profile* profile) NotificationService::AllSources()); registrar_.Add(this, NotificationType::EXTENSION_HOST_DESTROYED, Source<Profile>(profile)); - registrar_.Add(this, NotificationType::RENDERER_PROCESS_TERMINATED, - NotificationService::AllSources()); - registrar_.Add(this, NotificationType::RENDERER_PROCESS_CLOSED, - NotificationService::AllSources()); } ExtensionProcessManager::~ExtensionProcessManager() { @@ -84,39 +78,6 @@ ExtensionHost* ExtensionProcessManager::CreateBackgroundHost( return host; } -void ExtensionProcessManager::RegisterExtensionProcess( - std::string extension_id, int process_id) { - ProcessIDMap::const_iterator it = process_ids_.find(extension_id); - if (it != process_ids_.end() && (*it).second == process_id) - return; - - process_ids_[extension_id] = process_id; - - ExtensionsService* extension_service = - browsing_instance_->profile()->GetExtensionsService(); - - std::vector<std::string> page_action_ids; - Extension* extension = extension_service->GetExtensionById(extension_id); - for (PageActionMap::const_iterator i = extension->page_actions().begin(); - i != extension->page_actions().end(); ++i) { - page_action_ids.push_back(i->first); - } - - RenderProcessHost* rph = RenderProcessHost::FromID(process_id); - rph->Send(new ViewMsg_Extension_UpdatePageActions(extension_id, - page_action_ids)); -} - -void ExtensionProcessManager::UnregisterExtensionProcess(int process_id) { - ProcessIDMap::iterator it = process_ids_.begin(); - while (it != process_ids_.end()) { - if (it->second == process_id) - process_ids_.erase(it++); - else - ++it; - } -} - SiteInstance* ExtensionProcessManager::GetSiteInstanceForURL(const GURL& url) { return browsing_instance_->GetSiteInstanceForURL(url); } @@ -161,13 +122,6 @@ void ExtensionProcessManager::Observe(NotificationType type, break; } - case NotificationType::RENDERER_PROCESS_TERMINATED: - case NotificationType::RENDERER_PROCESS_CLOSED: { - RenderProcessHost* host = Source<RenderProcessHost>(source).ptr(); - UnregisterExtensionProcess(host->pid()); - break; - } - default: NOTREACHED(); } diff --git a/chrome/browser/extensions/extension_process_manager.h b/chrome/browser/extensions/extension_process_manager.h index e3d6b76..58f6639 100644 --- a/chrome/browser/extensions/extension_process_manager.h +++ b/chrome/browser/extensions/extension_process_manager.h @@ -5,9 +5,7 @@ #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_PROCESS_MANAGER_H_ #define CHROME_BROWSER_EXTENSIONS_EXTENSION_PROCESS_MANAGER_H_ -#include <map> #include <set> -#include <string> #include "base/ref_counted.h" #include "chrome/common/notification_registrar.h" @@ -45,13 +43,6 @@ class ExtensionProcessManager : public NotificationObserver { // Returns the SiteInstance that the given URL belongs to. SiteInstance* GetSiteInstanceForURL(const GURL& url); - // Register an extension process by |extension_id| and specifying which - // |process_id| it belongs to. - void RegisterExtensionProcess(std::string extension_id, int process_id); - - // Unregister an extension process with specified |process_id|. - void UnregisterExtensionProcess(int process_id); - // NotificationObserver: virtual void Observe(NotificationType type, const NotificationSource& source, @@ -78,10 +69,6 @@ class ExtensionProcessManager : public NotificationObserver { // controls process grouping. scoped_refptr<BrowsingInstance> browsing_instance_; - // A map of extension ID to the render_process_id that the extension lives in. - typedef std::map<std::string, int> ProcessIDMap; - ProcessIDMap process_ids_; - DISALLOW_COPY_AND_ASSIGN(ExtensionProcessManager); }; |