diff options
author | mpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-21 23:24:16 +0000 |
---|---|---|
committer | mpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-21 23:24:16 +0000 |
commit | a7ab1b782edde4b8558ccba857ea64cb1e8e8d1c (patch) | |
tree | be43e81cd80302d91ed9d0c9ddc4079f0e557b5a /chrome/browser/extensions | |
parent | 3a8d2de3be5629f532f4b26a4ddb7c0961cb25d7 (diff) | |
download | chromium_src-a7ab1b782edde4b8558ccba857ea64cb1e8e8d1c.zip chromium_src-a7ab1b782edde4b8558ccba857ea64cb1e8e8d1c.tar.gz chromium_src-a7ab1b782edde4b8558ccba857ea64cb1e8e8d1c.tar.bz2 |
Part 2 of extension event refactor.
Extension events are no longer broadcast to an entire process. They are
filtered by extension. This allows me to move the cross-incognito check into
the browser, and remove a bunch of cruft associated with that.
BUG=58214
TEST=no functional change
Review URL: http://codereview.chromium.org/3775015
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@63448 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions')
10 files changed, 187 insertions, 98 deletions
diff --git a/chrome/browser/extensions/events_apitest.cc b/chrome/browser/extensions/events_apitest.cc new file mode 100644 index 0000000..8319ae6 --- /dev/null +++ b/chrome/browser/extensions/events_apitest.cc @@ -0,0 +1,10 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/extensions/extension_apitest.h" +#include "chrome/common/chrome_switches.h" + +IN_PROC_BROWSER_TEST_F(ExtensionApiTest, Events) { + ASSERT_TRUE(RunExtensionTest("events")) << message_; +} diff --git a/chrome/browser/extensions/extension_browser_event_router.cc b/chrome/browser/extensions/extension_browser_event_router.cc index b9ef775..ce58dc7 100644 --- a/chrome/browser/extensions/extension_browser_event_router.cc +++ b/chrome/browser/extensions/extension_browser_event_router.cc @@ -66,21 +66,36 @@ ExtensionBrowserEventRouter* ExtensionBrowserEventRouter::GetInstance() { static void DispatchEvent(Profile* profile, const char* event_name, - const std::string json_args) { + const std::string& json_args) { if (profile->GetExtensionEventRouter()) { profile->GetExtensionEventRouter()->DispatchEventToRenderers( event_name, json_args, profile, GURL()); } } +static void DispatchEventToExtension(Profile* profile, + const std::string& extension_id, + const char* event_name, + const std::string& json_args) { + if (profile->GetExtensionEventRouter()) { + profile->GetExtensionEventRouter()->DispatchEventToExtension( + extension_id, event_name, json_args, profile, GURL()); + } +} + static void DispatchEventWithTab(Profile* profile, + const std::string& extension_id, const char* event_name, const TabContents* tab_contents) { ListValue args; args.Append(ExtensionTabUtil::CreateTabValue(tab_contents)); std::string json_args; base::JSONWriter::Write(&args, false, &json_args); - DispatchEvent(profile, event_name, json_args); + if (!extension_id.empty()) { + DispatchEventToExtension(profile, extension_id, event_name, json_args); + } else { + DispatchEvent(profile, event_name, json_args); + } } static void DispatchSimpleBrowserEvent(Profile* profile, @@ -244,7 +259,8 @@ void ExtensionBrowserEventRouter::OnBrowserSetLastActive( void ExtensionBrowserEventRouter::TabCreatedAt(TabContents* contents, int index, bool foreground) { - DispatchEventWithTab(contents->profile(), events::kOnTabCreated, contents); + DispatchEventWithTab(contents->profile(), "", events::kOnTabCreated, + contents); RegisterForTabNotifications(contents); } @@ -460,8 +476,7 @@ void ExtensionBrowserEventRouter::DispatchOldPageActionEvent( std::string json_args; base::JSONWriter::Write(&args, false, &json_args); - std::string event_name = std::string("pageActions/") + extension_id; - DispatchEvent(profile, event_name.c_str(), json_args); + DispatchEventToExtension(profile, extension_id, "pageActions", json_args); } void ExtensionBrowserEventRouter::PageActionExecuted( @@ -478,9 +493,8 @@ void ExtensionBrowserEventRouter::PageActionExecuted( NULL, NULL, &tab_contents, NULL)) { return; } - std::string event_name = ExtensionEventRouter::GetPerExtensionEventName( - "pageAction.onClicked", extension_id); - DispatchEventWithTab(profile, event_name.c_str(), tab_contents); + DispatchEventWithTab(profile, extension_id, "pageAction.onClicked", + tab_contents); } void ExtensionBrowserEventRouter::BrowserActionExecuted( @@ -489,7 +503,6 @@ void ExtensionBrowserEventRouter::BrowserActionExecuted( int tab_id = 0; if (!ExtensionTabUtil::GetDefaultTab(browser, &tab_contents, &tab_id)) return; - std::string event_name = ExtensionEventRouter::GetPerExtensionEventName( - "browserAction.onClicked", extension_id); - DispatchEventWithTab(profile, event_name.c_str(), tab_contents); + DispatchEventWithTab(profile, extension_id, "browserAction.onClicked", + tab_contents); } diff --git a/chrome/browser/extensions/extension_event_router.cc b/chrome/browser/extensions/extension_event_router.cc index 5e2707e..9d22da7 100644 --- a/chrome/browser/extensions/extension_event_router.cc +++ b/chrome/browser/extensions/extension_event_router.cc @@ -10,6 +10,7 @@ #include "chrome/browser/extensions/extension_processes_api.h" #include "chrome/browser/extensions/extension_processes_api_constants.h" #include "chrome/browser/extensions/extension_tabs_module.h" +#include "chrome/browser/extensions/extensions_service.h" #include "chrome/browser/profile.h" #include "chrome/browser/renderer_host/render_process_host.h" #include "chrome/common/extensions/extension.h" @@ -21,26 +22,46 @@ namespace { const char kDispatchEvent[] = "Event.dispatchJSON"; static void DispatchEvent(RenderProcessHost* renderer, + const std::string& extension_id, const std::string& event_name, const std::string& event_args, - bool cross_incognito, const GURL& event_url) { ListValue args; args.Set(0, Value::CreateStringValue(event_name)); args.Set(1, Value::CreateStringValue(event_args)); renderer->Send(new ViewMsg_ExtensionMessageInvoke(MSG_ROUTING_CONTROL, - kDispatchEvent, args, cross_incognito, event_url)); + extension_id, kDispatchEvent, args, event_url)); +} + +static bool CanCrossIncognito(Profile* profile, + const std::string& extension_id) { + // We allow the extension to see events and data from another profile iff it + // uses "spanning" behavior and it has incognito access. "split" mode + // extensions only see events for a matching profile. + Extension* extension = + profile->GetExtensionsService()->GetExtensionById(extension_id, false); + return (profile->GetExtensionsService()->IsIncognitoEnabled(extension) && + !extension->incognito_split_mode()); } } // namespace -// static -std::string ExtensionEventRouter::GetPerExtensionEventName( - const std::string& event_name, const std::string& extension_id) { - // This should match the method we use in extension_process_binding.js when - // setting up the corresponding chrome.Event object. - return event_name + "/" + extension_id; -} +struct ExtensionEventRouter::EventListener { + RenderProcessHost* process; + std::string extension_id; + + explicit EventListener(RenderProcessHost* process, + const std::string& extension_id) + : process(process), extension_id(extension_id) {} + + bool operator<(const EventListener& that) const { + if (process < that.process) + return true; + if (process == that.process && extension_id < that.extension_id) + return true; + return false; + } +}; ExtensionEventRouter::ExtensionEventRouter(Profile* profile) : profile_(profile), @@ -56,14 +77,14 @@ ExtensionEventRouter::~ExtensionEventRouter() { void ExtensionEventRouter::AddEventListener( const std::string& event_name, - int render_process_id) { - DCHECK_EQ(listeners_[event_name].count(render_process_id), 0u) << event_name; - listeners_[event_name].insert(render_process_id); + RenderProcessHost* process, + const std::string& extension_id) { + EventListener listener(process, extension_id); + DCHECK_EQ(listeners_[event_name].count(listener), 0u) << event_name; + listeners_[event_name].insert(listener); - if (extension_devtools_manager_.get()) { - extension_devtools_manager_->AddEventListener(event_name, - render_process_id); - } + if (extension_devtools_manager_.get()) + extension_devtools_manager_->AddEventListener(event_name, process->id()); // We lazily tell the TaskManager to start updating when listeners to the // processes.onUpdated event arrive. @@ -73,15 +94,16 @@ void ExtensionEventRouter::AddEventListener( void ExtensionEventRouter::RemoveEventListener( const std::string& event_name, - int render_process_id) { - DCHECK_EQ(listeners_[event_name].count(render_process_id), 1u) << - " PID=" << render_process_id << " event=" << event_name; - listeners_[event_name].erase(render_process_id); - - if (extension_devtools_manager_.get()) { - extension_devtools_manager_->RemoveEventListener(event_name, - render_process_id); - } + RenderProcessHost* process, + const std::string& extension_id) { + EventListener listener(process, extension_id); + DCHECK_EQ(listeners_[event_name].count(listener), 1u) << + " PID=" << process->id() << " extension=" << extension_id << + " event=" << event_name; + listeners_[event_name].erase(listener); + + if (extension_devtools_manager_.get()) + extension_devtools_manager_->RemoveEventListener(event_name, process->id()); // If a processes.onUpdated event listener is removed (or a process with one // exits), then we let the TaskManager know that it has one fewer listener. @@ -94,9 +116,40 @@ bool ExtensionEventRouter::HasEventListener(const std::string& event_name) { !listeners_[event_name].empty()); } +bool ExtensionEventRouter::ExtensionHasEventListener( + const std::string& extension_id, const std::string& event_name) { + ListenerMap::iterator it = listeners_.find(event_name); + if (it == listeners_.end()) + return false; + + std::set<EventListener>& listeners = it->second; + for (std::set<EventListener>::iterator listener = listeners.begin(); + listener != listeners.end(); ++listener) { + if (listener->extension_id == extension_id) + return true; + } + return false; +} + void ExtensionEventRouter::DispatchEventToRenderers( const std::string& event_name, const std::string& event_args, Profile* restrict_to_profile, const GURL& event_url) { + DispatchEventImpl("", event_name, event_args, restrict_to_profile, event_url); +} + +void ExtensionEventRouter::DispatchEventToExtension( + const std::string& extension_id, + const std::string& event_name, const std::string& event_args, + Profile* restrict_to_profile, const GURL& event_url) { + DCHECK(!extension_id.empty()); + DispatchEventImpl(extension_id, event_name, event_args, restrict_to_profile, + event_url); +} + +void ExtensionEventRouter::DispatchEventImpl( + const std::string& extension_id, + const std::string& event_name, const std::string& event_args, + Profile* restrict_to_profile, const GURL& event_url) { if (!profile_) return; @@ -107,33 +160,30 @@ void ExtensionEventRouter::DispatchEventToRenderers( if (it == listeners_.end()) return; - std::set<int>& pids = it->second; + std::set<EventListener>& listeners = it->second; // Send the event only to renderers that are listening for it. - for (std::set<int>::iterator pid = pids.begin(); pid != pids.end(); ++pid) { - RenderProcessHost* renderer = RenderProcessHost::FromID(*pid); - if (!renderer) - continue; + for (std::set<EventListener>::iterator listener = listeners.begin(); + listener != listeners.end(); ++listener) { if (!ChildProcessSecurityPolicy::GetInstance()-> - HasExtensionBindings(*pid)) { + HasExtensionBindings(listener->process->id())) { // Don't send browser-level events to unprivileged processes. continue; } + if (!extension_id.empty() && extension_id != listener->extension_id) + continue; + // Is this event from a different profile than the renderer (ie, an // incognito tab event sent to a normal process, or vice versa). - bool cross_incognito = - restrict_to_profile && renderer->profile() != restrict_to_profile; - DispatchEvent(renderer, event_name, event_args, cross_incognito, event_url); - } -} + bool cross_incognito = restrict_to_profile && + listener->process->profile() != restrict_to_profile; + if (cross_incognito && !CanCrossIncognito(profile_, listener->extension_id)) + continue; -void ExtensionEventRouter::DispatchEventToExtension( - const std::string& extension_id, - const std::string& event_name, const std::string& event_args, - Profile* restrict_to_profile, const GURL& event_url) { - DispatchEventToRenderers(GetPerExtensionEventName(event_name, extension_id), - event_args, restrict_to_profile, event_url); + DispatchEvent(listener->process, listener->extension_id, + event_name, event_args, event_url); + } } void ExtensionEventRouter::Observe(NotificationType type, @@ -146,9 +196,16 @@ void ExtensionEventRouter::Observe(NotificationType type, // Remove all event listeners associated with this renderer for (ListenerMap::iterator it = listeners_.begin(); it != listeners_.end(); ) { - ListenerMap::iterator current = it++; - if (current->second.count(renderer->id()) != 0) - RemoveEventListener(current->first, renderer->id()); + ListenerMap::iterator current_it = it++; + for (std::set<EventListener>::iterator jt = current_it->second.begin(); + jt != current_it->second.end(); ) { + std::set<EventListener>::iterator current_jt = jt++; + if (current_jt->process == renderer) { + RemoveEventListener(current_it->first, + current_jt->process, + current_jt->extension_id); + } + } } break; } diff --git a/chrome/browser/extensions/extension_event_router.h b/chrome/browser/extensions/extension_event_router.h index 5fb29e4..5e1ca97 100644 --- a/chrome/browser/extensions/extension_event_router.h +++ b/chrome/browser/extensions/extension_event_router.h @@ -24,37 +24,52 @@ class ExtensionEventRouter : public NotificationObserver { explicit ExtensionEventRouter(Profile* profile); ~ExtensionEventRouter(); - // Returns the event name for an event that is extension-specific. - static std::string GetPerExtensionEventName(const std::string& event_name, - const std::string& extension_id); - - // Add or remove |render_process_id| as a listener for |event_name|. + // Add or remove the process/extension pair as a listener for |event_name|. + // Note that multiple extensions can share a process due to process + // collapsing. Also, a single extension can have 2 processes if it is a split + // mode extension. void AddEventListener(const std::string& event_name, - int render_process_id); + RenderProcessHost* process, + const std::string& extension_id); void RemoveEventListener(const std::string& event_name, - int render_process_id); + RenderProcessHost* process, + const std::string& extension_id); // Returns true if there is at least one listener for the given event. bool HasEventListener(const std::string& event_name); + // Returns true if the extension is listening to the given event. + bool ExtensionHasEventListener(const std::string& extension_id, + const std::string& event_name); + // Send an event to every registered extension renderer. If // |restrict_to_profile| is non-NULL, then the event will not be sent to other // profiles unless the extension has permission (e.g. incognito tab update -> // normal profile only works if extension is allowed incognito access). If // |event_url| is not empty, the event is only sent to extension with host // permissions for this url. - virtual void DispatchEventToRenderers( + void DispatchEventToRenderers( const std::string& event_name, const std::string& event_args, Profile* restrict_to_profile, const GURL& event_url); - // Same as above, except use the extension-specific naming scheme for the - // event. This is used by events that are per-extension. + // Same as above, except only send the event to the given extension. void DispatchEventToExtension( const std::string& extension_id, const std::string& event_name, const std::string& event_args, Profile* restrict_to_profile, const GURL& event_url); + protected: + // Shared by DispatchEvent*. If |extension_id| is empty, the event is + // broadcast. + virtual void DispatchEventImpl( + const std::string& extension_id, + const std::string& event_name, const std::string& event_args, + Profile* restrict_to_profile, const GURL& event_url); + private: + // An extension listening to an event. + struct EventListener; + virtual void Observe(NotificationType type, const NotificationSource& source, const NotificationDetails& details); @@ -65,9 +80,9 @@ class ExtensionEventRouter : public NotificationObserver { scoped_refptr<ExtensionDevToolsManager> extension_devtools_manager_; - // A map between an event name and a set of process id's that are listening + // A map between an event name and a set of extensions that are listening // to that event. - typedef std::map<std::string, std::set<int> > ListenerMap; + typedef std::map<std::string, std::set<EventListener> > ListenerMap; ListenerMap listeners_; DISALLOW_COPY_AND_ASSIGN(ExtensionEventRouter); diff --git a/chrome/browser/extensions/extension_function_dispatcher.cc b/chrome/browser/extensions/extension_function_dispatcher.cc index 7a99137..e3ca590 100644 --- a/chrome/browser/extensions/extension_function_dispatcher.cc +++ b/chrome/browser/extensions/extension_function_dispatcher.cc @@ -373,9 +373,6 @@ ExtensionFunctionDispatcher::ExtensionFunctionDispatcher( epm->RegisterExtensionProcess(extension_id(), render_view_host->process()->id()); - bool incognito_enabled = - profile()->GetExtensionsService()->IsIncognitoEnabled(extension); - // If the extension has permission to load chrome://favicon/ resources we need // to make sure that the DOMUIFavIconSource is registered with the // ChromeURLDataManager. @@ -395,8 +392,6 @@ ExtensionFunctionDispatcher::ExtensionFunctionDispatcher( extension->id(), extension->api_permissions())); render_view_host->Send(new ViewMsg_Extension_SetHostPermissions( extension->url(), extension->host_permissions())); - render_view_host->Send(new ViewMsg_Extension_ExtensionSetIncognitoEnabled( - extension->id(), incognito_enabled, extension->incognito_split_mode())); NotificationService::current()->Notify( NotificationType::EXTENSION_FUNCTION_DISPATCHER_CREATED, diff --git a/chrome/browser/extensions/extension_menu_manager.cc b/chrome/browser/extensions/extension_menu_manager.cc index d5f33e6..307c339 100644 --- a/chrome/browser/extensions/extension_menu_manager.cc +++ b/chrome/browser/extensions/extension_menu_manager.cc @@ -440,9 +440,9 @@ void ExtensionMenuManager::ExecuteCommand( std::string json_args; base::JSONWriter::Write(&args, false, &json_args); - std::string event_name = "contextMenus/" + item->extension_id(); - event_router->DispatchEventToRenderers( - event_name, json_args, profile, GURL()); + std::string event_name = "contextMenus"; + event_router->DispatchEventToExtension( + item->extension_id(), event_name, json_args, profile, GURL()); } void ExtensionMenuManager::Observe(NotificationType type, diff --git a/chrome/browser/extensions/extension_menu_manager_unittest.cc b/chrome/browser/extensions/extension_menu_manager_unittest.cc index 3dc6f69..0b653ba 100644 --- a/chrome/browser/extensions/extension_menu_manager_unittest.cc +++ b/chrome/browser/extensions/extension_menu_manager_unittest.cc @@ -336,10 +336,11 @@ class MockExtensionEventRouter : public ExtensionEventRouter { explicit MockExtensionEventRouter(Profile* profile) : ExtensionEventRouter(profile) {} - MOCK_METHOD4(DispatchEventToRenderers, void(const std::string& event_name, - const std::string& event_args, - Profile* source_profile, - const GURL& event_url)); + MOCK_METHOD5(DispatchEventImpl, void(const std::string& extension_id, + const std::string& event_name, + const std::string& event_args, + Profile* source_profile, + const GURL& event_url)); private: DISALLOW_COPY_AND_ASSIGN(MockExtensionEventRouter); @@ -414,15 +415,17 @@ TEST_F(ExtensionMenuManagerTest, ExecuteCommand) { .WillOnce(Return(mock_event_router.get())); // Use the magic of googlemock to save a parameter to our mock's - // DispatchEventToRenderers method into event_args. + // DispatchEventImpl method into event_args. std::string event_args; - std::string expected_event_name = "contextMenus/" + item->extension_id(); + std::string expected_event_name = "contextMenus"; EXPECT_CALL(*mock_event_router.get(), - DispatchEventToRenderers(expected_event_name, _, - &profile, - GURL())) + DispatchEventImpl(item->extension_id(), + expected_event_name, + _, + &profile, + GURL())) .Times(1) - .WillOnce(SaveArg<1>(&event_args)); + .WillOnce(SaveArg<2>(&event_args)); manager_.ExecuteCommand(&profile, NULL /* tab_contents */, params, id); diff --git a/chrome/browser/extensions/extension_message_service.cc b/chrome/browser/extensions/extension_message_service.cc index e8562ff..a3a13c1 100644 --- a/chrome/browser/extensions/extension_message_service.cc +++ b/chrome/browser/extensions/extension_message_service.cc @@ -70,7 +70,7 @@ static void DispatchOnConnect(const ExtensionMessageService::MessagePort& port, args.Set(4, Value::CreateStringValue(target_extension_id)); CHECK(port.sender); port.sender->Send(new ViewMsg_ExtensionMessageInvoke(port.routing_id, - ExtensionMessageService::kDispatchOnConnect, args, false, GURL())); + "", ExtensionMessageService::kDispatchOnConnect, args, GURL())); } static void DispatchOnDisconnect( @@ -78,7 +78,7 @@ static void DispatchOnDisconnect( ListValue args; args.Set(0, Value::CreateIntegerValue(source_port_id)); port.sender->Send(new ViewMsg_ExtensionMessageInvoke(port.routing_id, - ExtensionMessageService::kDispatchOnDisconnect, args, false, GURL())); + "", ExtensionMessageService::kDispatchOnDisconnect, args, GURL())); } static void DispatchOnMessage(const ExtensionMessageService::MessagePort& port, @@ -87,7 +87,7 @@ static void DispatchOnMessage(const ExtensionMessageService::MessagePort& port, args.Set(0, Value::CreateStringValue(message)); args.Set(1, Value::CreateIntegerValue(source_port_id)); port.sender->Send(new ViewMsg_ExtensionMessageInvoke(port.routing_id, - ExtensionMessageService::kDispatchOnMessage, args, false, GURL())); + "", ExtensionMessageService::kDispatchOnMessage, args, GURL())); } } // namespace diff --git a/chrome/browser/extensions/extension_messages_browsertest.cc b/chrome/browser/extensions/extension_messages_browsertest.cc index 5e78c79..bd36a80 100644 --- a/chrome/browser/extensions/extension_messages_browsertest.cc +++ b/chrome/browser/extensions/extension_messages_browsertest.cc @@ -22,15 +22,14 @@ static void DispatchOnConnect(int source_port_id, const std::string& name, args.Set(3, Value::CreateStringValue(EventBindings::kTestingExtensionId)); args.Set(4, Value::CreateStringValue(EventBindings::kTestingExtensionId)); RendererExtensionBindings::Invoke( - ExtensionMessageService::kDispatchOnConnect, args, NULL, false, GURL()); + "", ExtensionMessageService::kDispatchOnConnect, args, NULL, GURL()); } static void DispatchOnDisconnect(int source_port_id) { ListValue args; args.Set(0, Value::CreateIntegerValue(source_port_id)); RendererExtensionBindings::Invoke( - ExtensionMessageService::kDispatchOnDisconnect, args, NULL, false, - GURL()); + "", ExtensionMessageService::kDispatchOnDisconnect, args, NULL, GURL()); } static void DispatchOnMessage(const std::string& message, int source_port_id) { @@ -38,7 +37,7 @@ static void DispatchOnMessage(const std::string& message, int source_port_id) { args.Set(0, Value::CreateStringValue(message)); args.Set(1, Value::CreateIntegerValue(source_port_id)); RendererExtensionBindings::Invoke( - ExtensionMessageService::kDispatchOnMessage, args, NULL, false, GURL()); + "", ExtensionMessageService::kDispatchOnMessage, args, NULL, GURL()); } // Tests that the bindings for opening a channel to an extension and sending diff --git a/chrome/browser/extensions/extension_omnibox_api.cc b/chrome/browser/extensions/extension_omnibox_api.cc index 6d9e4e4..3e4887d 100644 --- a/chrome/browser/extensions/extension_omnibox_api.cc +++ b/chrome/browser/extensions/extension_omnibox_api.cc @@ -43,9 +43,8 @@ void ExtensionOmniboxEventRouter::OnInputStarted( bool ExtensionOmniboxEventRouter::OnInputChanged( Profile* profile, const std::string& extension_id, const std::string& input, int suggest_id) { - std::string event_name = ExtensionEventRouter::GetPerExtensionEventName( - events::kOnInputChanged, extension_id); - if (!profile->GetExtensionEventRouter()->HasEventListener(event_name)) + if (!profile->GetExtensionEventRouter()->ExtensionHasEventListener( + extension_id, events::kOnInputChanged)) return false; ListValue args; @@ -63,8 +62,6 @@ bool ExtensionOmniboxEventRouter::OnInputChanged( void ExtensionOmniboxEventRouter::OnInputEntered( Profile* profile, const std::string& extension_id, const std::string& input) { - std::string event_name = events::kOnInputEntered + extension_id; - ListValue args; args.Set(0, Value::CreateStringValue(input)); std::string json_args; |