diff options
Diffstat (limited to 'chrome')
24 files changed, 119 insertions, 133 deletions
diff --git a/chrome/browser/extensions/api/identity/identity_api.cc b/chrome/browser/extensions/api/identity/identity_api.cc index cbb1844..9dd1358 100644 --- a/chrome/browser/extensions/api/identity/identity_api.cc +++ b/chrome/browser/extensions/api/identity/identity_api.cc @@ -232,7 +232,7 @@ void IdentityAPI::OnAccountSignInChanged(const gaia::AccountIds& ids, scoped_ptr<base::ListValue> args = api::identity::OnSignInChanged::Create(account_info, is_signed_in); - scoped_ptr<Event> event(new Event(events::UNKNOWN, + scoped_ptr<Event> event(new Event(events::IDENTITY_ON_SIGN_IN_CHANGED, api::identity::OnSignInChanged::kEventName, args.Pass(), browser_context_)); diff --git a/chrome/browser/extensions/api/identity/web_auth_flow.cc b/chrome/browser/extensions/api/identity/web_auth_flow.cc index ec972e0..8382833 100644 --- a/chrome/browser/extensions/api/identity/web_auth_flow.cc +++ b/chrome/browser/extensions/api/identity/web_auth_flow.cc @@ -89,8 +89,8 @@ void WebAuthFlow::Start() { args->AppendString("silent"); scoped_ptr<Event> event( - new Event(events::UNKNOWN, identity_private::OnWebFlowRequest::kEventName, - args.Pass())); + new Event(events::IDENTITY_PRIVATE_ON_WEB_FLOW_REQUEST, + identity_private::OnWebFlowRequest::kEventName, args.Pass())); event->restrict_to_browser_context = profile_; ExtensionSystem* system = ExtensionSystem::Get(profile_); diff --git a/chrome/browser/extensions/api/image_writer_private/operation_manager.cc b/chrome/browser/extensions/api/image_writer_private/operation_manager.cc index 105c977..3d888b8 100644 --- a/chrome/browser/extensions/api/image_writer_private/operation_manager.cc +++ b/chrome/browser/extensions/api/image_writer_private/operation_manager.cc @@ -161,8 +161,8 @@ void OperationManager::OnProgress(const ExtensionId& extension_id, scoped_ptr<base::ListValue> args( image_writer_api::OnWriteProgress::Create(info)); scoped_ptr<Event> event( - new Event(events::UNKNOWN, image_writer_api::OnWriteProgress::kEventName, - args.Pass())); + new Event(events::IMAGE_WRITER_PRIVATE_ON_WRITE_PROGRESS, + image_writer_api::OnWriteProgress::kEventName, args.Pass())); EventRouter::Get(browser_context_) ->DispatchEventToExtension(extension_id, event.Pass()); @@ -173,8 +173,8 @@ void OperationManager::OnComplete(const ExtensionId& extension_id) { scoped_ptr<base::ListValue> args(image_writer_api::OnWriteComplete::Create()); scoped_ptr<Event> event( - new Event(events::UNKNOWN, image_writer_api::OnWriteComplete::kEventName, - args.Pass())); + new Event(events::IMAGE_WRITER_PRIVATE_ON_WRITE_COMPLETE, + image_writer_api::OnWriteComplete::kEventName, args.Pass())); EventRouter::Get(browser_context_) ->DispatchEventToExtension(extension_id, event.Pass()); @@ -196,7 +196,7 @@ void OperationManager::OnError(const ExtensionId& extension_id, scoped_ptr<base::ListValue> args( image_writer_api::OnWriteError::Create(info, error_message)); - scoped_ptr<Event> event(new Event(events::UNKNOWN, + scoped_ptr<Event> event(new Event(events::IMAGE_WRITER_PRIVATE_ON_WRITE_ERROR, image_writer_api::OnWriteError::kEventName, args.Pass())); diff --git a/chrome/browser/extensions/api/log_private/log_private_api_chromeos.cc b/chrome/browser/extensions/api/log_private/log_private_api_chromeos.cc index 13dc7ff..a25bbf9 100644 --- a/chrome/browser/extensions/api/log_private/log_private_api_chromeos.cc +++ b/chrome/browser/extensions/api/log_private/log_private_api_chromeos.cc @@ -249,9 +249,9 @@ void LogPrivateAPI::AddEntriesOnUI(scoped_ptr<base::ListValue> value) { // Create the event's arguments value. scoped_ptr<base::ListValue> event_args(new base::ListValue()); event_args->Append(value->DeepCopy()); - scoped_ptr<Event> event(new Event(::extensions::events::UNKNOWN, - ::events::kOnCapturedEvents, - event_args.Pass())); + scoped_ptr<Event> event( + new Event(::extensions::events::LOG_PRIVATE_ON_CAPTURED_EVENTS, + ::events::kOnCapturedEvents, event_args.Pass())); EventRouter::Get(browser_context_) ->DispatchEventToExtension(*ix, event.Pass()); } diff --git a/chrome/browser/extensions/api/mdns/mdns_api.cc b/chrome/browser/extensions/api/mdns/mdns_api.cc index 53beddc..477b11b 100644 --- a/chrome/browser/extensions/api/mdns/mdns_api.cc +++ b/chrome/browser/extensions/api/mdns/mdns_api.cc @@ -172,8 +172,9 @@ void MDnsAPI::OnDnsSdEvent(const std::string& service_type, } scoped_ptr<base::ListValue> results = mdns::OnServiceList::Create(args); - scoped_ptr<Event> event(new Event( - events::UNKNOWN, mdns::OnServiceList::kEventName, results.Pass())); + scoped_ptr<Event> event(new Event(events::MDNS_ON_SERVICE_LIST, + mdns::OnServiceList::kEventName, + results.Pass())); event->restrict_to_browser_context = browser_context_; event->filter_info.SetServiceType(service_type); diff --git a/chrome/browser/extensions/api/notification_provider/notification_provider_api.cc b/chrome/browser/extensions/api/notification_provider/notification_provider_api.cc index c07bfc1..55f62eb 100644 --- a/chrome/browser/extensions/api/notification_provider/notification_provider_api.cc +++ b/chrome/browser/extensions/api/notification_provider/notification_provider_api.cc @@ -65,8 +65,8 @@ void NotificationProviderEventRouter::Create( sender_id, notification_id, options); scoped_ptr<Event> event(new Event( - events::UNKNOWN, api::notification_provider::OnCreated::kEventName, - args.Pass())); + events::NOTIFICATION_PROVIDER_ON_CREATED, + api::notification_provider::OnCreated::kEventName, args.Pass())); EventRouter::Get(profile_) ->DispatchEventToExtension(notification_provider_id, event.Pass()); @@ -82,8 +82,8 @@ void NotificationProviderEventRouter::Update( sender_id, notification_id, options); scoped_ptr<Event> event(new Event( - events::UNKNOWN, api::notification_provider::OnUpdated::kEventName, - args.Pass())); + events::NOTIFICATION_PROVIDER_ON_UPDATED, + api::notification_provider::OnUpdated::kEventName, args.Pass())); EventRouter::Get(profile_) ->DispatchEventToExtension(notification_provider_id, event.Pass()); @@ -97,8 +97,8 @@ void NotificationProviderEventRouter::Clear( api::notification_provider::OnCleared::Create(sender_id, notification_id); scoped_ptr<Event> event(new Event( - events::UNKNOWN, api::notification_provider::OnCleared::kEventName, - args.Pass())); + events::NOTIFICATION_PROVIDER_ON_CLEARED, + api::notification_provider::OnCleared::kEventName, args.Pass())); EventRouter::Get(profile_) ->DispatchEventToExtension(notification_provider_id, event.Pass()); diff --git a/chrome/browser/extensions/api/omnibox/omnibox_api.cc b/chrome/browser/extensions/api/omnibox/omnibox_api.cc index e403c87..d232f63 100644 --- a/chrome/browser/extensions/api/omnibox/omnibox_api.cc +++ b/chrome/browser/extensions/api/omnibox/omnibox_api.cc @@ -99,7 +99,7 @@ std::string GetTemplateURLStringForExtension(const std::string& extension_id) { // static void ExtensionOmniboxEventRouter::OnInputStarted( Profile* profile, const std::string& extension_id) { - scoped_ptr<Event> event(new Event(events::UNKNOWN, + scoped_ptr<Event> event(new Event(events::OMNIBOX_ON_INPUT_STARTED, omnibox::OnInputStarted::kEventName, make_scoped_ptr(new base::ListValue()))); event->restrict_to_browser_context = profile; @@ -120,8 +120,9 @@ bool ExtensionOmniboxEventRouter::OnInputChanged( args->Set(0, new base::StringValue(input)); args->Set(1, new base::FundamentalValue(suggest_id)); - scoped_ptr<Event> event(new Event( - events::UNKNOWN, omnibox::OnInputChanged::kEventName, args.Pass())); + scoped_ptr<Event> event(new Event(events::OMNIBOX_ON_INPUT_CHANGED, + omnibox::OnInputChanged::kEventName, + args.Pass())); event->restrict_to_browser_context = profile; event_router->DispatchEventToExtension(extension_id, event.Pass()); return true; @@ -152,8 +153,9 @@ void ExtensionOmniboxEventRouter::OnInputEntered( else args->Set(1, new base::StringValue(kCurrentTabDisposition)); - scoped_ptr<Event> event(new Event( - events::UNKNOWN, omnibox::OnInputEntered::kEventName, args.Pass())); + scoped_ptr<Event> event(new Event(events::OMNIBOX_ON_INPUT_ENTERED, + omnibox::OnInputEntered::kEventName, + args.Pass())); event->restrict_to_browser_context = profile; EventRouter::Get(profile) ->DispatchEventToExtension(extension_id, event.Pass()); @@ -167,7 +169,7 @@ void ExtensionOmniboxEventRouter::OnInputEntered( // static void ExtensionOmniboxEventRouter::OnInputCancelled( Profile* profile, const std::string& extension_id) { - scoped_ptr<Event> event(new Event(events::UNKNOWN, + scoped_ptr<Event> event(new Event(events::OMNIBOX_ON_INPUT_CANCELLED, omnibox::OnInputCancelled::kEventName, make_scoped_ptr(new base::ListValue()))); event->restrict_to_browser_context = profile; diff --git a/chrome/browser/extensions/api/passwords_private/passwords_private_event_router.cc b/chrome/browser/extensions/api/passwords_private/passwords_private_event_router.cc index c37eadb..550fc02 100644 --- a/chrome/browser/extensions/api/passwords_private/passwords_private_event_router.cc +++ b/chrome/browser/extensions/api/passwords_private/passwords_private_event_router.cc @@ -81,7 +81,7 @@ void PasswordsPrivateEventRouter::SendSavedPasswordListToListeners() { return; scoped_ptr<Event> extension_event( - new Event(events::UNKNOWN, + new Event(events::PASSWORDS_PRIVATE_ON_SAVED_PASSWORDS_LIST_CHANGED, api::passwords_private::OnSavedPasswordsListChanged::kEventName, cached_saved_password_parameters_->CreateDeepCopy())); event_router_->BroadcastEvent(extension_event.Pass()); @@ -101,7 +101,7 @@ void PasswordsPrivateEventRouter::SendPasswordExceptionListToListeners() { return; scoped_ptr<Event> extension_event(new Event( - events::UNKNOWN, + events::PASSWORDS_PRIVATE_ON_PASSWORD_EXCEPTIONS_LIST_CHANGED, api::passwords_private::OnPasswordExceptionsListChanged::kEventName, cached_password_exception_parameters_->CreateDeepCopy())); event_router_->BroadcastEvent(extension_event.Pass()); @@ -120,7 +120,7 @@ void PasswordsPrivateEventRouter::OnPlaintextPasswordFetched( event_value->Append(params.ToValue()); scoped_ptr<Event> extension_event(new Event( - events::UNKNOWN, + events::PASSWORDS_PRIVATE_ON_PLAINTEXT_PASSWORD_RETRIEVED, api::passwords_private::OnPlaintextPasswordRetrieved::kEventName, event_value.Pass())); event_router_->BroadcastEvent(extension_event.Pass()); diff --git a/chrome/browser/extensions/api/screenlock_private/screenlock_private_api.cc b/chrome/browser/extensions/api/screenlock_private/screenlock_private_api.cc index bc58952..f93b1ef 100644 --- a/chrome/browser/extensions/api/screenlock_private/screenlock_private_api.cc +++ b/chrome/browser/extensions/api/screenlock_private/screenlock_private_api.cc @@ -15,10 +15,10 @@ #include "extensions/browser/app_window/app_window_registry.h" #include "extensions/browser/event_router.h" -namespace screenlock = extensions::api::screenlock_private; - namespace extensions { +namespace screenlock = api::screenlock_private; + namespace { screenlock::AuthType FromLockHandlerAuthType( @@ -114,14 +114,16 @@ ScreenlockPrivateEventRouter::~ScreenlockPrivateEventRouter() {} void ScreenlockPrivateEventRouter::OnScreenDidLock( proximity_auth::ScreenlockBridge::LockHandler::ScreenType screen_type) { - DispatchEvent(screenlock::OnChanged::kEventName, - new base::FundamentalValue(true)); + DispatchEvent(events::SCREENLOCK_PRIVATE_ON_CHANGED, + screenlock::OnChanged::kEventName, + new base::FundamentalValue(true)); } void ScreenlockPrivateEventRouter::OnScreenDidUnlock( proximity_auth::ScreenlockBridge::LockHandler::ScreenType screen_type) { - DispatchEvent(screenlock::OnChanged::kEventName, - new base::FundamentalValue(false)); + DispatchEvent(events::SCREENLOCK_PRIVATE_ON_CHANGED, + screenlock::OnChanged::kEventName, + new base::FundamentalValue(false)); } void ScreenlockPrivateEventRouter::OnFocusedUserChanged( @@ -129,21 +131,22 @@ void ScreenlockPrivateEventRouter::OnFocusedUserChanged( } void ScreenlockPrivateEventRouter::DispatchEvent( + events::HistogramValue histogram_value, const std::string& event_name, base::Value* arg) { scoped_ptr<base::ListValue> args(new base::ListValue()); if (arg) args->Append(arg); - scoped_ptr<extensions::Event> event(new extensions::Event( - extensions::events::UNKNOWN, event_name, args.Pass())); - extensions::EventRouter::Get(browser_context_)->BroadcastEvent(event.Pass()); + scoped_ptr<Event> event(new Event(histogram_value, event_name, args.Pass())); + EventRouter::Get(browser_context_)->BroadcastEvent(event.Pass()); } -static base::LazyInstance<extensions::BrowserContextKeyedAPIFactory< - ScreenlockPrivateEventRouter> > g_factory = LAZY_INSTANCE_INITIALIZER; +static base::LazyInstance< + BrowserContextKeyedAPIFactory<ScreenlockPrivateEventRouter>> g_factory = + LAZY_INSTANCE_INITIALIZER; // static -extensions::BrowserContextKeyedAPIFactory<ScreenlockPrivateEventRouter>* +BrowserContextKeyedAPIFactory<ScreenlockPrivateEventRouter>* ScreenlockPrivateEventRouter::GetFactoryInstance() { return g_factory.Pointer(); } @@ -155,8 +158,7 @@ void ScreenlockPrivateEventRouter::Shutdown() { bool ScreenlockPrivateEventRouter::OnAuthAttempted( proximity_auth::ScreenlockBridge::LockHandler::AuthType auth_type, const std::string& value) { - extensions::EventRouter* router = - extensions::EventRouter::Get(browser_context_); + EventRouter* router = EventRouter::Get(browser_context_); if (!router->HasEventListener(screenlock::OnAuthAttempted::kEventName)) return false; @@ -164,9 +166,9 @@ bool ScreenlockPrivateEventRouter::OnAuthAttempted( args->AppendString(screenlock::ToString(FromLockHandlerAuthType(auth_type))); args->AppendString(value); - scoped_ptr<extensions::Event> event(new extensions::Event( - extensions::events::UNKNOWN, screenlock::OnAuthAttempted::kEventName, - args.Pass())); + scoped_ptr<Event> event( + new Event(events::SCREENLOCK_PRIVATE_ON_AUTH_ATTEMPTED, + screenlock::OnAuthAttempted::kEventName, args.Pass())); router->BroadcastEvent(event.Pass()); return true; } diff --git a/chrome/browser/extensions/api/screenlock_private/screenlock_private_api.h b/chrome/browser/extensions/api/screenlock_private/screenlock_private_api.h index d120c46..7e284b0 100644 --- a/chrome/browser/extensions/api/screenlock_private/screenlock_private_api.h +++ b/chrome/browser/extensions/api/screenlock_private/screenlock_private_api.h @@ -10,6 +10,7 @@ #include "chrome/browser/extensions/chrome_extension_function.h" #include "components/proximity_auth/screenlock_bridge.h" #include "extensions/browser/browser_context_keyed_api_factory.h" +#include "extensions/browser/extension_event_histogram_value.h" namespace extensions { @@ -51,7 +52,7 @@ class ScreenlockPrivateAcceptAuthAttemptFunction }; class ScreenlockPrivateEventRouter - : public extensions::BrowserContextKeyedAPI, + : public BrowserContextKeyedAPI, public proximity_auth::ScreenlockBridge::Observer { public: explicit ScreenlockPrivateEventRouter(content::BrowserContext* context); @@ -62,9 +63,8 @@ class ScreenlockPrivateEventRouter const std::string& value); // BrowserContextKeyedAPI - static extensions::BrowserContextKeyedAPIFactory< - ScreenlockPrivateEventRouter>* - GetFactoryInstance(); + static BrowserContextKeyedAPIFactory<ScreenlockPrivateEventRouter>* + GetFactoryInstance(); void Shutdown() override; // proximity_auth::ScreenlockBridge::Observer @@ -76,8 +76,7 @@ class ScreenlockPrivateEventRouter void OnFocusedUserChanged(const std::string& user_id) override; private: - friend class extensions::BrowserContextKeyedAPIFactory< - ScreenlockPrivateEventRouter>; + friend class BrowserContextKeyedAPIFactory<ScreenlockPrivateEventRouter>; // BrowserContextKeyedAPI static const char* service_name() { @@ -86,7 +85,9 @@ class ScreenlockPrivateEventRouter static const bool kServiceIsNULLWhileTesting = true; static const bool kServiceRedirectedInIncognito = true; - void DispatchEvent(const std::string& event_name, base::Value* arg); + void DispatchEvent(events::HistogramValue histogram_value, + const std::string& event_name, + base::Value* arg); content::BrowserContext* browser_context_; DISALLOW_COPY_AND_ASSIGN(ScreenlockPrivateEventRouter); diff --git a/chrome/browser/extensions/api/search_engines_private/search_engines_private_event_router.cc b/chrome/browser/extensions/api/search_engines_private/search_engines_private_event_router.cc index 769d699..4fb8ecb 100644 --- a/chrome/browser/extensions/api/search_engines_private/search_engines_private_event_router.cc +++ b/chrome/browser/extensions/api/search_engines_private/search_engines_private_event_router.cc @@ -100,7 +100,7 @@ void SearchEnginesPrivateEventRouter::OnTemplateURLServiceChanged() { scoped_ptr<base::ListValue> args( search_engines_private::OnSearchEnginesChanged::Create(engines)); scoped_ptr<Event> extension_event(new Event( - events::UNKNOWN, + events::SEARCH_ENGINES_PRIVATE_ON_SEARCH_ENGINES_CHANGED, search_engines_private::OnSearchEnginesChanged::kEventName, args.Pass())); EventRouter::Get(context_)->BroadcastEvent(extension_event.Pass()); } diff --git a/chrome/browser/extensions/api/sessions/sessions_api.cc b/chrome/browser/extensions/api/sessions/sessions_api.cc index e453f32..f98aca0 100644 --- a/chrome/browser/extensions/api/sessions/sessions_api.cc +++ b/chrome/browser/extensions/api/sessions/sessions_api.cc @@ -619,8 +619,9 @@ SessionsEventRouter::~SessionsEventRouter() { void SessionsEventRouter::TabRestoreServiceChanged( TabRestoreService* service) { scoped_ptr<base::ListValue> args(new base::ListValue()); - EventRouter::Get(profile_)->BroadcastEvent(make_scoped_ptr(new Event( - events::UNKNOWN, api::sessions::OnChanged::kEventName, args.Pass()))); + EventRouter::Get(profile_)->BroadcastEvent(make_scoped_ptr( + new Event(events::SESSIONS_ON_CHANGED, + api::sessions::OnChanged::kEventName, args.Pass()))); } void SessionsEventRouter::TabRestoreServiceDestroyed( diff --git a/chrome/browser/extensions/api/settings_private/settings_private_event_router.cc b/chrome/browser/extensions/api/settings_private/settings_private_event_router.cc index 153dd3f..6a9582e 100644 --- a/chrome/browser/extensions/api/settings_private/settings_private_event_router.cc +++ b/chrome/browser/extensions/api/settings_private/settings_private_event_router.cc @@ -139,8 +139,8 @@ void SettingsPrivateEventRouter::OnPreferenceChanged( api::settings_private::OnPrefsChanged::Create(prefs)); scoped_ptr<Event> extension_event(new Event( - events::UNKNOWN, api::settings_private::OnPrefsChanged::kEventName, - args.Pass())); + events::SETTINGS_PRIVATE_ON_PREFS_CHANGED, + api::settings_private::OnPrefsChanged::kEventName, args.Pass())); event_router->BroadcastEvent(extension_event.Pass()); } diff --git a/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_manager.cc b/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_manager.cc index 6cd0f0a..39160c2 100644 --- a/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_manager.cc +++ b/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_manager.cc @@ -78,8 +78,8 @@ void SignedInDevicesChangeObserver::OnDeviceInfoChange() { scoped_ptr<base::ListValue> result = api::signed_in_devices::OnDeviceInfoChange::Create(args); scoped_ptr<Event> event(new Event( - events::UNKNOWN, api::signed_in_devices::OnDeviceInfoChange::kEventName, - result.Pass())); + events::SIGNED_IN_DEVICES_ON_DEVICE_INFO_CHANGE, + api::signed_in_devices::OnDeviceInfoChange::kEventName, result.Pass())); event->restrict_to_browser_context = profile_; diff --git a/chrome/browser/extensions/api/streams_private/streams_private_api.cc b/chrome/browser/extensions/api/streams_private/streams_private_api.cc index 57ebe6d..9b23daa 100644 --- a/chrome/browser/extensions/api/streams_private/streams_private_api.cc +++ b/chrome/browser/extensions/api/streams_private/streams_private_api.cc @@ -110,9 +110,10 @@ void StreamsPrivateAPI::ExecuteMimeTypeHandler( CreateResponseHeadersDictionary(stream->response_headers.get(), &info.response_headers.additional_properties); - scoped_ptr<Event> event(new Event( - events::UNKNOWN, streams_private::OnExecuteMimeTypeHandler::kEventName, - streams_private::OnExecuteMimeTypeHandler::Create(info))); + scoped_ptr<Event> event( + new Event(events::STREAMS_PRIVATE_ON_EXECUTE_MIME_TYPE_HANDLER, + streams_private::OnExecuteMimeTypeHandler::kEventName, + streams_private::OnExecuteMimeTypeHandler::Create(info))); EventRouter::Get(browser_context_) ->DispatchEventToExtension(extension_id, event.Pass()); diff --git a/chrome/browser/extensions/api/streams_private/streams_private_apitest.cc b/chrome/browser/extensions/api/streams_private/streams_private_apitest.cc index 4cacfcf..e34f6fc 100644 --- a/chrome/browser/extensions/api/streams_private/streams_private_apitest.cc +++ b/chrome/browser/extensions/api/streams_private/streams_private_apitest.cc @@ -180,10 +180,10 @@ class StreamsPrivateApiTest : public ExtensionApiTest { info.tab_id = 10; info.expected_content_size = 20; - scoped_ptr<Event> event( - new Event(extensions::events::UNKNOWN, - streams_private::OnExecuteMimeTypeHandler::kEventName, - streams_private::OnExecuteMimeTypeHandler::Create(info))); + scoped_ptr<Event> event(new Event( + extensions::events::STREAMS_PRIVATE_ON_EXECUTE_MIME_TYPE_HANDLER, + streams_private::OnExecuteMimeTypeHandler::kEventName, + streams_private::OnExecuteMimeTypeHandler::Create(info))); extensions::EventRouter::Get(browser()->profile()) ->DispatchEventToExtension(test_extension_id_, event.Pass()); diff --git a/chrome/browser/extensions/api/system_indicator/system_indicator_manager.cc b/chrome/browser/extensions/api/system_indicator/system_indicator_manager.cc index 35d6afd..07cc8c0 100644 --- a/chrome/browser/extensions/api/system_indicator/system_indicator_manager.cc +++ b/chrome/browser/extensions/api/system_indicator/system_indicator_manager.cc @@ -82,7 +82,7 @@ void ExtensionIndicatorIcon::OnStatusIconClicked() { api::system_indicator::OnClicked::Create()); EventRouter* event_router = EventRouter::Get(profile_); - scoped_ptr<Event> event(new Event(events::UNKNOWN, + scoped_ptr<Event> event(new Event(events::SYSTEM_INDICATOR_ON_CLICKED, system_indicator::OnClicked::kEventName, params.Pass(), profile_)); event_router->DispatchEventToExtension( diff --git a/chrome/browser/extensions/api/tab_capture/tab_capture_registry.cc b/chrome/browser/extensions/api/tab_capture/tab_capture_registry.cc index 5543d8b..866f6ce 100644 --- a/chrome/browser/extensions/api/tab_capture/tab_capture_registry.cc +++ b/chrome/browser/extensions/api/tab_capture/tab_capture_registry.cc @@ -313,8 +313,9 @@ void TabCaptureRegistry::DispatchStatusChangeEvent( tab_capture::CaptureInfo info; request->GetCaptureInfo(&info); args->Append(info.ToValue().release()); - scoped_ptr<Event> event(new Event( - events::UNKNOWN, tab_capture::OnStatusChanged::kEventName, args.Pass())); + scoped_ptr<Event> event(new Event(events::TAB_CAPTURE_ON_STATUS_CHANGED, + tab_capture::OnStatusChanged::kEventName, + args.Pass())); event->restrict_to_browser_context = browser_context_; router->DispatchEventToExtension(request->extension_id(), event.Pass()); diff --git a/chrome/browser/extensions/api/tabs/tabs_event_router.cc b/chrome/browser/extensions/api/tabs/tabs_event_router.cc index abf5243..c2bc47d 100644 --- a/chrome/browser/extensions/api/tabs/tabs_event_router.cc +++ b/chrome/browser/extensions/api/tabs/tabs_event_router.cc @@ -222,8 +222,8 @@ void TabsEventRouter::TabCreatedAt(WebContents* contents, bool active) { Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext()); scoped_ptr<base::ListValue> args(new base::ListValue); - scoped_ptr<Event> event( - new Event(events::UNKNOWN, tabs::OnCreated::kEventName, args.Pass())); + scoped_ptr<Event> event(new Event(events::TABS_ON_CREATED, + tabs::OnCreated::kEventName, args.Pass())); event->restrict_to_browser_context = profile; event->user_gesture = EventRouter::USER_GESTURE_NOT_ENABLED; event->will_dispatch_callback = @@ -257,8 +257,8 @@ void TabsEventRouter::TabInsertedAt(WebContents* contents, args->Append(object_args); Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext()); - DispatchEvent(profile, tabs::OnAttached::kEventName, args.Pass(), - EventRouter::USER_GESTURE_UNKNOWN); + DispatchEvent(profile, events::TABS_ON_ATTACHED, tabs::OnAttached::kEventName, + args.Pass(), EventRouter::USER_GESTURE_UNKNOWN); } void TabsEventRouter::TabDetachedAt(WebContents* contents, int index) { @@ -280,10 +280,8 @@ void TabsEventRouter::TabDetachedAt(WebContents* contents, int index) { args->Append(object_args); Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext()); - DispatchEvent(profile, - tabs::OnDetached::kEventName, - args.Pass(), - EventRouter::USER_GESTURE_UNKNOWN); + DispatchEvent(profile, events::TABS_ON_DETACHED, tabs::OnDetached::kEventName, + args.Pass(), EventRouter::USER_GESTURE_UNKNOWN); } void TabsEventRouter::TabClosingAt(TabStripModel* tab_strip_model, @@ -302,10 +300,8 @@ void TabsEventRouter::TabClosingAt(TabStripModel* tab_strip_model, args->Append(object_args); Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext()); - DispatchEvent(profile, - tabs::OnRemoved::kEventName, - args.Pass(), - EventRouter::USER_GESTURE_UNKNOWN); + DispatchEvent(profile, events::TABS_ON_REMOVED, tabs::OnRemoved::kEventName, + args.Pass(), EventRouter::USER_GESTURE_UNKNOWN); int removed_count = tab_entries_.erase(tab_id); DCHECK_GT(removed_count, 0); @@ -335,20 +331,19 @@ void TabsEventRouter::ActiveTabChanged(WebContents* old_contents, reason & CHANGE_REASON_USER_GESTURE ? EventRouter::USER_GESTURE_ENABLED : EventRouter::USER_GESTURE_NOT_ENABLED; - DispatchEvent(profile, + DispatchEvent(profile, events::TABS_ON_SELECTION_CHANGED, tabs::OnSelectionChanged::kEventName, - scoped_ptr<base::ListValue>(args->DeepCopy()), - gesture); - DispatchEvent(profile, + scoped_ptr<base::ListValue>(args->DeepCopy()), gesture); + DispatchEvent(profile, events::TABS_ON_ACTIVE_CHANGED, tabs::OnActiveChanged::kEventName, - scoped_ptr<base::ListValue>(args->DeepCopy()), - gesture); + scoped_ptr<base::ListValue>(args->DeepCopy()), gesture); // The onActivated event takes one argument: {windowId, tabId}. args->Remove(0, NULL); object_args->Set(tabs_constants::kTabIdKey, new FundamentalValue(tab_id)); - DispatchEvent(profile, tabs::OnActivated::kEventName, args.Pass(), gesture); + DispatchEvent(profile, events::TABS_ON_ACTIVATED, + tabs::OnActivated::kEventName, args.Pass(), gesture); } void TabsEventRouter::TabSelectionChanged( @@ -380,13 +375,12 @@ void TabsEventRouter::TabSelectionChanged( // The onHighlighted event replaced onHighlightChanged. Profile* profile = tab_strip_model->profile(); - DispatchEvent(profile, + DispatchEvent(profile, events::TABS_ON_HIGHLIGHT_CHANGED, tabs::OnHighlightChanged::kEventName, scoped_ptr<base::ListValue>(args->DeepCopy()), EventRouter::USER_GESTURE_UNKNOWN); - DispatchEvent(profile, - tabs::OnHighlighted::kEventName, - args.Pass(), + DispatchEvent(profile, events::TABS_ON_HIGHLIGHTED, + tabs::OnHighlighted::kEventName, args.Pass(), EventRouter::USER_GESTURE_UNKNOWN); } @@ -408,10 +402,8 @@ void TabsEventRouter::TabMoved(WebContents* contents, args->Append(object_args); Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext()); - DispatchEvent(profile, - tabs::OnMoved::kEventName, - args.Pass(), - EventRouter::USER_GESTURE_UNKNOWN); + DispatchEvent(profile, events::TABS_ON_MOVED, tabs::OnMoved::kEventName, + args.Pass(), EventRouter::USER_GESTURE_UNKNOWN); } void TabsEventRouter::TabUpdated( @@ -455,6 +447,7 @@ void TabsEventRouter::FaviconUrlUpdated(WebContents* contents) { void TabsEventRouter::DispatchEvent( Profile* profile, + events::HistogramValue histogram_value, const std::string& event_name, scoped_ptr<base::ListValue> args, EventRouter::UserGestureState user_gesture) { @@ -462,26 +455,12 @@ void TabsEventRouter::DispatchEvent( if (!profile_->IsSameProfile(profile) || !event_router) return; - scoped_ptr<Event> event(new Event(events::UNKNOWN, event_name, args.Pass())); + scoped_ptr<Event> event(new Event(histogram_value, event_name, args.Pass())); event->restrict_to_browser_context = profile; event->user_gesture = user_gesture; event_router->BroadcastEvent(event.Pass()); } -void TabsEventRouter::DispatchSimpleBrowserEvent( - Profile* profile, const int window_id, const std::string& event_name) { - if (!profile_->IsSameProfile(profile)) - return; - - scoped_ptr<base::ListValue> args(new base::ListValue); - args->Append(new FundamentalValue(window_id)); - - DispatchEvent(profile, - event_name, - args.Pass(), - EventRouter::USER_GESTURE_UNKNOWN); -} - void TabsEventRouter::DispatchTabUpdatedEvent( WebContents* contents, scoped_ptr<base::DictionaryValue> changed_properties) { @@ -504,7 +483,7 @@ void TabsEventRouter::DispatchTabUpdatedEvent( Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext()); scoped_ptr<Event> event(new Event( - events::UNKNOWN, tabs::OnUpdated::kEventName, args_base.Pass())); + events::TABS_ON_UPDATED, tabs::OnUpdated::kEventName, args_base.Pass())); event->restrict_to_browser_context = profile; event->user_gesture = EventRouter::USER_GESTURE_NOT_ENABLED; event->will_dispatch_callback = @@ -569,9 +548,8 @@ void TabsEventRouter::TabReplacedAt(TabStripModel* tab_strip_model, args->Append(new FundamentalValue(old_tab_id)); DispatchEvent(Profile::FromBrowserContext(new_contents->GetBrowserContext()), - tabs::OnReplaced::kEventName, - args.Pass(), - EventRouter::USER_GESTURE_UNKNOWN); + events::TABS_ON_REPLACED, tabs::OnReplaced::kEventName, + args.Pass(), EventRouter::USER_GESTURE_UNKNOWN); // Update tab_entries_. const int removed_count = tab_entries_.erase(old_tab_id); @@ -617,7 +595,7 @@ void TabsEventRouter::OnZoomChanged( // Dispatch the |onZoomChange| event. Profile* profile = Profile::FromBrowserContext( data.web_contents->GetBrowserContext()); - DispatchEvent(profile, + DispatchEvent(profile, events::TABS_ON_ZOOM_CHANGE, tabs::OnZoomChange::kEventName, api::tabs::OnZoomChange::Create(zoom_change_info), EventRouter::USER_GESTURE_UNKNOWN); diff --git a/chrome/browser/extensions/api/tabs/tabs_event_router.h b/chrome/browser/extensions/api/tabs/tabs_event_router.h index 2273047..1c6a9eb 100644 --- a/chrome/browser/extensions/api/tabs/tabs_event_router.h +++ b/chrome/browser/extensions/api/tabs/tabs_event_router.h @@ -106,6 +106,7 @@ class TabsEventRouter : public TabStripModelObserver, // The TabsEventRouter listens to events for all profiles, // so we avoid duplication by dropping events destined for other profiles. void DispatchEvent(Profile* profile, + events::HistogramValue histogram_value, const std::string& event_name, scoped_ptr<base::ListValue> args, EventRouter::UserGestureState user_gesture); @@ -116,10 +117,6 @@ class TabsEventRouter : public TabStripModelObserver, scoped_ptr<base::ListValue> event_args, scoped_ptr<base::ListValue> cross_incognito_args); - void DispatchSimpleBrowserEvent(Profile* profile, - const int window_id, - const std::string& event_name); - // Packages |changed_properties| as a tab updated event for the tab |contents| // and dispatches the event to the extension. void DispatchTabUpdatedEvent( diff --git a/chrome/browser/extensions/api/tabs/windows_event_router.cc b/chrome/browser/extensions/api/tabs/windows_event_router.cc index f25f209..0eb9756 100644 --- a/chrome/browser/extensions/api/tabs/windows_event_router.cc +++ b/chrome/browser/extensions/api/tabs/windows_event_router.cc @@ -65,8 +65,8 @@ void WindowsEventRouter::OnWindowControllerAdded( base::DictionaryValue* window_dictionary = window_controller->CreateWindowValue(); args->Append(window_dictionary); - DispatchEvent(windows::OnCreated::kEventName, window_controller->profile(), - args.Pass()); + DispatchEvent(events::WINDOWS_ON_CREATED, windows::OnCreated::kEventName, + window_controller->profile(), args.Pass()); } void WindowsEventRouter::OnWindowControllerRemoved( @@ -79,9 +79,8 @@ void WindowsEventRouter::OnWindowControllerRemoved( int window_id = window_controller->GetWindowId(); scoped_ptr<base::ListValue> args(new base::ListValue()); args->Append(new base::FundamentalValue(window_id)); - DispatchEvent(windows::OnRemoved::kEventName, - window_controller->profile(), - args.Pass()); + DispatchEvent(events::WINDOWS_ON_REMOVED, windows::OnRemoved::kEventName, + window_controller->profile(), args.Pass()); } #if !defined(OS_MACOSX) @@ -145,7 +144,7 @@ void WindowsEventRouter::OnActiveWindowChanged( if (!HasEventListener(windows::OnFocusChanged::kEventName)) return; - scoped_ptr<Event> event(new Event(events::UNKNOWN, + scoped_ptr<Event> event(new Event(events::WINDOWS_ON_FOCUS_CHANGED, windows::OnFocusChanged::kEventName, make_scoped_ptr(new base::ListValue()))); event->will_dispatch_callback = @@ -155,10 +154,11 @@ void WindowsEventRouter::OnActiveWindowChanged( EventRouter::Get(profile_)->BroadcastEvent(event.Pass()); } -void WindowsEventRouter::DispatchEvent(const std::string& event_name, - Profile* profile, - scoped_ptr<base::ListValue> args) { - scoped_ptr<Event> event(new Event(events::UNKNOWN, event_name, args.Pass())); +void WindowsEventRouter::DispatchEvent(events::HistogramValue histogram_value, + const std::string& event_name, + Profile* profile, + scoped_ptr<base::ListValue> args) { + scoped_ptr<Event> event(new Event(histogram_value, event_name, args.Pass())); event->restrict_to_browser_context = profile; EventRouter::Get(profile)->BroadcastEvent(event.Pass()); } diff --git a/chrome/browser/extensions/api/tabs/windows_event_router.h b/chrome/browser/extensions/api/tabs/windows_event_router.h index b865482..c9ee0b3 100644 --- a/chrome/browser/extensions/api/tabs/windows_event_router.h +++ b/chrome/browser/extensions/api/tabs/windows_event_router.h @@ -12,6 +12,7 @@ #include "chrome/browser/extensions/window_controller_list_observer.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" +#include "extensions/browser/extension_event_histogram_value.h" #if !defined(OS_MACOSX) #include "ui/views/focus/widget_focus_manager.h" @@ -55,7 +56,8 @@ class WindowsEventRouter : public WindowControllerListObserver, void OnActiveWindowChanged(WindowController* window_controller); private: - void DispatchEvent(const std::string& event_name, + void DispatchEvent(events::HistogramValue histogram_value, + const std::string& event_name, Profile* profile, scoped_ptr<base::ListValue> args); bool HasEventListener(const std::string& event_name); diff --git a/chrome/browser/extensions/api/terminal/terminal_private_api.cc b/chrome/browser/extensions/api/terminal/terminal_private_api.cc index ca77af7..49326bc 100644 --- a/chrome/browser/extensions/api/terminal/terminal_private_api.cc +++ b/chrome/browser/extensions/api/terminal/terminal_private_api.cc @@ -64,7 +64,7 @@ void NotifyProcessOutput(Profile* profile, extensions::EventRouter* event_router = extensions::EventRouter::Get(profile); if (profile && event_router) { scoped_ptr<extensions::Event> event(new extensions::Event( - extensions::events::UNKNOWN, + extensions::events::TERMINAL_PRIVATE_ON_PROCESS_OUTPUT, terminal_private::OnProcessOutput::kEventName, args.Pass())); event_router->DispatchEventToExtension(extension_id, event.Pass()); } diff --git a/chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_private_api.cc b/chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_private_api.cc index e6b7f16..d56ed0c 100644 --- a/chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_private_api.cc +++ b/chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_private_api.cc @@ -92,7 +92,7 @@ void WebrtcAudioPrivateEventService::SignalEvent() { if (router->ExtensionHasEventListener(extension_id, kEventName) && extension->permissions_data()->HasAPIPermission("webrtcAudioPrivate")) { scoped_ptr<Event> event( - new Event(events::UNKNOWN, kEventName, + new Event(events::WEBRTC_AUDIO_PRIVATE_ON_SINKS_CHANGED, kEventName, make_scoped_ptr(new base::ListValue()).Pass())); router->DispatchEventToExtension(extension_id, event.Pass()); } |