diff options
author | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-23 18:14:28 +0000 |
---|---|---|
committer | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-23 18:14:28 +0000 |
commit | 89622004872be7f7ddaa24fa1694f76c7b9539b6 (patch) | |
tree | 81b8a42c7649c8cbca99d04305470ccbc1fe61fa /chrome/browser/views | |
parent | b7544eef7b81458a88597419eed6617c41e6d3dc (diff) | |
download | chromium_src-89622004872be7f7ddaa24fa1694f76c7b9539b6.zip chromium_src-89622004872be7f7ddaa24fa1694f76c7b9539b6.tar.gz chromium_src-89622004872be7f7ddaa24fa1694f76c7b9539b6.tar.bz2 |
UMA cleanup. Replacing calls to RecordAction(char*) to use a new structure.
That way it is easier to keep track of those constants in reporting tools.
TEST=Covered with standard ui tests
Patch by Frank Mantek <fmantek@google.com>.
Review URL: http://codereview.chromium.org/811005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42362 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views')
20 files changed, 174 insertions, 115 deletions
diff --git a/chrome/browser/views/about_chrome_view.cc b/chrome/browser/views/about_chrome_view.cc index 331ba14..a698d21 100644 --- a/chrome/browser/views/about_chrome_view.cc +++ b/chrome/browser/views/about_chrome_view.cc @@ -829,19 +829,21 @@ void AboutChromeView::UpdateStatus(GoogleUpdateUpgradeResult result, switch (result) { case UPGRADE_STARTED: - UserMetrics::RecordAction("Upgrade_Started", profile_); + UserMetrics::RecordAction(UserMetricsAction("Upgrade_Started"), profile_); check_button_status_ = CHECKBUTTON_DISABLED; show_throbber = true; update_label_.SetText(l10n_util::GetString(IDS_UPGRADE_STARTED)); break; case UPGRADE_CHECK_STARTED: - UserMetrics::RecordAction("UpgradeCheck_Started", profile_); + UserMetrics::RecordAction(UserMetricsAction("UpgradeCheck_Started"), + profile_); check_button_status_ = CHECKBUTTON_HIDDEN; show_throbber = true; update_label_.SetText(l10n_util::GetString(IDS_UPGRADE_CHECK_STARTED)); break; case UPGRADE_IS_AVAILABLE: - UserMetrics::RecordAction("UpgradeCheck_UpgradeIsAvailable", profile_); + UserMetrics::RecordAction( + UserMetricsAction("UpgradeCheck_UpgradeIsAvailable"), profile_); check_button_status_ = CHECKBUTTON_ENABLED; update_label_.SetText( l10n_util::GetStringF(IDS_UPGRADE_AVAILABLE, @@ -865,7 +867,8 @@ void AboutChromeView::UpdateStatus(GoogleUpdateUpgradeResult result, if (!installed_version.get() || !installed_version->IsHigherThan(running_version.get())) { #endif - UserMetrics::RecordAction("UpgradeCheck_AlreadyUpToDate", profile_); + UserMetrics::RecordAction( + UserMetricsAction("UpgradeCheck_AlreadyUpToDate"), profile_); check_button_status_ = CHECKBUTTON_HIDDEN; std::wstring update_label_text = l10n_util::GetStringF(IDS_UPGRADE_ALREADY_UP_TO_DATE, @@ -885,9 +888,11 @@ void AboutChromeView::UpdateStatus(GoogleUpdateUpgradeResult result, } case UPGRADE_SUCCESSFUL: { if (result == UPGRADE_ALREADY_UP_TO_DATE) - UserMetrics::RecordAction("UpgradeCheck_AlreadyUpgraded", profile_); + UserMetrics::RecordAction( + UserMetricsAction("UpgradeCheck_AlreadyUpgraded"), profile_); else - UserMetrics::RecordAction("UpgradeCheck_Upgraded", profile_); + UserMetrics::RecordAction(UserMetricsAction("UpgradeCheck_Upgraded"), + profile_); check_button_status_ = CHECKBUTTON_HIDDEN; const std::wstring& update_string = new_version_available_.empty() ? l10n_util::GetStringF(IDS_UPGRADE_SUCCESSFUL_NOVERSION, @@ -905,7 +910,8 @@ void AboutChromeView::UpdateStatus(GoogleUpdateUpgradeResult result, break; } case UPGRADE_ERROR: - UserMetrics::RecordAction("UpgradeCheck_Error", profile_); + UserMetrics::RecordAction(UserMetricsAction("UpgradeCheck_Error"), + profile_); check_button_status_ = CHECKBUTTON_HIDDEN; update_label_.SetText(l10n_util::GetStringF(IDS_UPGRADE_ERROR, IntToWString(error_code))); diff --git a/chrome/browser/views/bookmark_bar_view.cc b/chrome/browser/views/bookmark_bar_view.cc index 03a4a9c..a887487 100644 --- a/chrome/browser/views/bookmark_bar_view.cc +++ b/chrome/browser/views/bookmark_bar_view.cc @@ -1098,7 +1098,8 @@ void BookmarkBarView::BookmarkNodeFavIconLoaded(BookmarkModel* model, void BookmarkBarView::WriteDragData(View* sender, const gfx::Point& press_pt, OSExchangeData* data) { - UserMetrics::RecordAction("BookmarkBar_DragButton", profile_); + UserMetrics::RecordAction(UserMetricsAction("BookmarkBar_DragButton"), + profile_); for (int i = 0; i < GetBookmarkButtonCount(); ++i) { if (sender == GetBookmarkButton(i)) { @@ -1217,7 +1218,8 @@ void BookmarkBarView::ButtonPressed(views::Button* sender, bookmark_utils::OpenAll(GetWindow()->GetNativeWindow(), profile_, GetPageNavigator(), node, disposition_from_event_flags); } - UserMetrics::RecordAction("ClickedBookmarkBarURLButton", profile_); + UserMetrics::RecordAction(UserMetricsAction("ClickedBookmarkBarURLButton"), + profile_); } void BookmarkBarView::ShowContextMenu(View* source, diff --git a/chrome/browser/views/bookmark_bubble_view.cc b/chrome/browser/views/bookmark_bubble_view.cc index ef9d5a4..ec4db98 100644 --- a/chrome/browser/views/bookmark_bubble_view.cc +++ b/chrome/browser/views/bookmark_bubble_view.cc @@ -331,7 +331,8 @@ void BookmarkBubbleView::ButtonPressed( void BookmarkBubbleView::LinkActivated(Link* source, int event_flags) { DCHECK(source == remove_link_); - UserMetrics::RecordAction("BookmarkBubble_Unstar", profile_); + UserMetrics::RecordAction(UserMetricsAction("BookmarkBubble_Unstar"), + profile_); // Set this so we remove the bookmark after the window closes. remove_bookmark_ = true; @@ -344,7 +345,8 @@ void BookmarkBubbleView::ItemChanged(Combobox* combobox, int prev_index, int new_index) { if (new_index + 1 == parent_model_.GetItemCount()) { - UserMetrics::RecordAction("BookmarkBubble_EditFromCombobox", profile_); + UserMetrics::RecordAction( + UserMetricsAction("BookmarkBubble_EditFromCombobox"), profile_); ShowEditor(); return; @@ -381,7 +383,8 @@ void BookmarkBubbleView::Close() { void BookmarkBubbleView::HandleButtonPressed(views::Button* sender) { if (sender == edit_button_) { - UserMetrics::RecordAction("BookmarkBubble_Edit", profile_); + UserMetrics::RecordAction(UserMetricsAction("BookmarkBubble_Edit"), + profile_); ShowEditor(); } else { DCHECK(sender == close_button_); @@ -436,8 +439,9 @@ void BookmarkBubbleView::ApplyEdits() { const std::wstring new_title = UTF16ToWide(title_tf_->text()); if (new_title != node->GetTitle()) { model->SetTitle(node, new_title); - UserMetrics::RecordAction("BookmarkBubble_ChangeTitleInBubble", - profile_); + UserMetrics::RecordAction( + UserMetricsAction("BookmarkBubble_ChangeTitleInBubble"), + profile_); } // Last index means 'Choose another folder...' if (parent_combobox_->selected_item() < @@ -445,7 +449,8 @@ void BookmarkBubbleView::ApplyEdits() { const BookmarkNode* new_parent = parent_model_.GetNodeAt(parent_combobox_->selected_item()); if (new_parent != node->GetParent()) { - UserMetrics::RecordAction("BookmarkBubble_ChangeParent", profile_); + UserMetrics::RecordAction( + UserMetricsAction("BookmarkBubble_ChangeParent"), profile_); model->Move(node, new_parent, new_parent->GetChildCount()); } } diff --git a/chrome/browser/views/bookmark_context_menu_controller_views.cc b/chrome/browser/views/bookmark_context_menu_controller_views.cc index 9b8a8e8..1cae184 100644 --- a/chrome/browser/views/bookmark_context_menu_controller_views.cc +++ b/chrome/browser/views/bookmark_context_menu_controller_views.cc @@ -285,16 +285,19 @@ void BookmarkContextMenuControllerViews::ExecuteCommand(int id) { WindowOpenDisposition initial_disposition; if (id == IDS_BOOMARK_BAR_OPEN_ALL) { initial_disposition = NEW_FOREGROUND_TAB; - UserMetrics::RecordAction("BookmarkBar_ContextMenu_OpenAll", - profile_); + UserMetrics::RecordAction( + UserMetricsAction("BookmarkBar_ContextMenu_OpenAll"), + profile_); } else if (id == IDS_BOOMARK_BAR_OPEN_ALL_NEW_WINDOW) { initial_disposition = NEW_WINDOW; - UserMetrics::RecordAction("BookmarkBar_ContextMenu_OpenAllInNewWindow", - profile_); + UserMetrics::RecordAction( + UserMetricsAction("BookmarkBar_ContextMenu_OpenAllInNewWindow"), + profile_); } else { initial_disposition = OFF_THE_RECORD; - UserMetrics::RecordAction("BookmarkBar_ContextMenu_OpenAllIncognito", - profile_); + UserMetrics::RecordAction( + UserMetricsAction("BookmarkBar_ContextMenu_OpenAllIncognito"), + profile_); } bookmark_utils::OpenAll(parent_window_, profile_, navigator_, selection_, initial_disposition); @@ -303,7 +306,8 @@ void BookmarkContextMenuControllerViews::ExecuteCommand(int id) { case IDS_BOOKMARK_BAR_RENAME_FOLDER: case IDS_BOOKMARK_BAR_EDIT: - UserMetrics::RecordAction("BookmarkBar_ContextMenu_Edit", profile_); + UserMetrics::RecordAction( + UserMetricsAction("BookmarkBar_ContextMenu_Edit"), profile_); if (selection_.size() != 1) { NOTREACHED(); @@ -326,7 +330,8 @@ void BookmarkContextMenuControllerViews::ExecuteCommand(int id) { break; case IDS_BOOKMARK_BAR_REMOVE: { - UserMetrics::RecordAction("BookmarkBar_ContextMenu_Remove", profile_); + UserMetrics::RecordAction( + UserMetricsAction("BookmarkBar_ContextMenu_Remove"), profile_); delegate_->WillRemoveBookmarks(selection_); for (size_t i = 0; i < selection_.size(); ++i) { @@ -339,7 +344,8 @@ void BookmarkContextMenuControllerViews::ExecuteCommand(int id) { } case IDS_BOOMARK_BAR_ADD_NEW_BOOKMARK: { - UserMetrics::RecordAction("BookmarkBar_ContextMenu_Add", profile_); + UserMetrics::RecordAction( + UserMetricsAction("BookmarkBar_ContextMenu_Add"), profile_); BookmarkEditor::Configuration editor_config; BookmarkEditor::Handler* handler = NULL; @@ -357,8 +363,9 @@ void BookmarkContextMenuControllerViews::ExecuteCommand(int id) { } case IDS_BOOMARK_BAR_NEW_FOLDER: { - UserMetrics::RecordAction("BookmarkBar_ContextMenu_NewFolder", - profile_); + UserMetrics::RecordAction( + UserMetricsAction("BookmarkBar_ContextMenu_NewFolder"), + profile_); EditFolderController::Show(profile_, parent_window_, GetParentForNewNodes(), true, configuration_ != BOOKMARK_BAR); @@ -370,8 +377,9 @@ void BookmarkContextMenuControllerViews::ExecuteCommand(int id) { break; case IDS_BOOKMARK_MANAGER_SHOW_IN_FOLDER: - UserMetrics::RecordAction("BookmarkBar_ContextMenu_ShowInFolder", - profile_); + UserMetrics::RecordAction( + UserMetricsAction("BookmarkBar_ContextMenu_ShowInFolder"), + profile_); if (selection_.size() != 1) { NOTREACHED(); @@ -382,7 +390,8 @@ void BookmarkContextMenuControllerViews::ExecuteCommand(int id) { break; case IDS_BOOKMARK_MANAGER: - UserMetrics::RecordAction("ShowBookmarkManager", profile_); + UserMetrics::RecordAction(UserMetricsAction("ShowBookmarkManager"), + profile_); { Browser* browser = BrowserList::GetLastActiveWithProfile(profile_); if (browser) @@ -393,7 +402,8 @@ void BookmarkContextMenuControllerViews::ExecuteCommand(int id) { break; case IDS_BOOKMARK_MANAGER_SORT: - UserMetrics::RecordAction("BookmarkManager_Sort", profile_); + UserMetrics::RecordAction(UserMetricsAction("BookmarkManager_Sort"), + profile_); model->SortChildren(parent_); break; diff --git a/chrome/browser/views/bookmark_manager_view.cc b/chrome/browser/views/bookmark_manager_view.cc index 43e3c75..2a99fdf 100644 --- a/chrome/browser/views/bookmark_manager_view.cc +++ b/chrome/browser/views/bookmark_manager_view.cc @@ -521,7 +521,8 @@ void BookmarkManagerView::ButtonPressed(views::Button* sender, DCHECK(sync_service_); sync_service_->ShowLoginDialog(); } else { - UserMetrics::RecordAction("BookmarkManager_Sync", profile_); + UserMetrics::RecordAction(UserMetricsAction("BookmarkManager_Sync"), + profile_); sync_ui_util::OpenSyncMyBookmarksDialog( profile_, ProfileSyncService::START_FROM_BOOKMARK_MANAGER); } @@ -585,12 +586,14 @@ void BookmarkManagerView::RunMenu(views::View* source, const gfx::Point& pt) { void BookmarkManagerView::ExecuteCommand(int id) { switch (id) { case IDS_BOOKMARK_MANAGER_IMPORT_MENU: - UserMetrics::RecordAction("BookmarkManager_Import", profile_); + UserMetrics::RecordAction(UserMetricsAction("BookmarkManager_Import"), + profile_); ShowImportBookmarksFileChooser(); break; case IDS_BOOKMARK_MANAGER_EXPORT_MENU: - UserMetrics::RecordAction("BookmarkManager_Export", profile_); + UserMetrics::RecordAction(UserMetricsAction("BookmarkManager_Export"), + profile_); ShowExportBookmarksFileChooser(); break; diff --git a/chrome/browser/views/bookmark_menu_button.cc b/chrome/browser/views/bookmark_menu_button.cc index fc4fd85..c16b7fc 100644 --- a/chrome/browser/views/bookmark_menu_button.cc +++ b/chrome/browser/views/bookmark_menu_button.cc @@ -129,7 +129,8 @@ void BookmarkMenuButton::RunMenu(views::View* source, bool for_drop) { Profile* profile = browser_->profile(); - UserMetrics::RecordAction("BookmarkMenu_clicked", profile); + UserMetrics::RecordAction(UserMetricsAction("BookmarkMenu_clicked"), + profile); BookmarkMenuController* menu = new BookmarkMenuController( browser_, profile, browser_->GetSelectedTabContents(), hwnd, diff --git a/chrome/browser/views/bookmark_menu_controller_views.cc b/chrome/browser/views/bookmark_menu_controller_views.cc index 2437d7f..a5b9b03 100644 --- a/chrome/browser/views/bookmark_menu_controller_views.cc +++ b/chrome/browser/views/bookmark_menu_controller_views.cc @@ -227,7 +227,8 @@ void BookmarkMenuController::WriteDragData(MenuItemView* sender, OSExchangeData* data) { DCHECK(sender && data); - UserMetrics::RecordAction("BookmarkBar_DragFromFolder", profile_); + UserMetrics::RecordAction(UserMetricsAction("BookmarkBar_DragFromFolder"), + profile_); BookmarkDragData drag_data(menu_id_to_node_map_[sender->GetCommand()]); drag_data.Write(profile_, data); diff --git a/chrome/browser/views/first_run_bubble.cc b/chrome/browser/views/first_run_bubble.cc index 913956b..b4f73b1 100644 --- a/chrome/browser/views/first_run_bubble.cc +++ b/chrome/browser/views/first_run_bubble.cc @@ -157,10 +157,13 @@ void FirstRunBubbleView::BubbleShown() { void FirstRunBubbleView::ButtonPressed(views::Button* sender, const views::Event& event) { - UserMetrics::RecordAction("FirstRunBubbleView_Clicked", profile_); + UserMetrics::RecordAction(UserMetricsAction("FirstRunBubbleView_Clicked"), + profile_); bubble_window_->Close(); if (change_button_ == sender) { - UserMetrics::RecordAction("FirstRunBubbleView_ChangeButton", profile_); + UserMetrics::RecordAction( + UserMetricsAction("FirstRunBubbleView_ChangeButton"), + profile_); Browser* browser = BrowserList::GetLastActive(); if (browser) { ShowOptionsWindow(OPTIONS_PAGE_GENERAL, OPTIONS_GROUP_DEFAULT_SEARCH, @@ -310,7 +313,8 @@ void FirstRunOEMBubbleView::BubbleShown() { void FirstRunOEMBubbleView::ButtonPressed(views::Button* sender, const views::Event& event) { - UserMetrics::RecordAction("FirstRunOEMBubbleView_Clicked", profile_); + UserMetrics::RecordAction(UserMetricsAction("FirstRunOEMBubbleView_Clicked"), + profile_); bubble_window_->Close(); } diff --git a/chrome/browser/views/first_run_customize_view.cc b/chrome/browser/views/first_run_customize_view.cc index aad06a7..263be85 100644 --- a/chrome/browser/views/first_run_customize_view.cc +++ b/chrome/browser/views/first_run_customize_view.cc @@ -199,15 +199,18 @@ bool FirstRunCustomizeView::Accept() { quick_shortcut_cbox_->SetEnabled(false); if (desktop_shortcut_cbox_->checked()) { - UserMetrics::RecordAction("FirstRunCustom_Do_DesktopShortcut", profile_); + UserMetrics::RecordAction( + UserMetricsAction("FirstRunCustom_Do_DesktopShortcut"), profile_); CreateDesktopShortcut(); } if (quick_shortcut_cbox_->checked()) { - UserMetrics::RecordAction("FirstRunCustom_Do_QuickLShortcut", profile_); + UserMetrics::RecordAction( + UserMetricsAction("FirstRunCustom_Do_QuickLShortcut"), profile_); CreateQuickLaunchShortcut(); } if (!import_cbox_->checked()) { - UserMetrics::RecordAction("FirstRunCustom_No_Import", profile_); + UserMetrics::RecordAction(UserMetricsAction("FirstRunCustom_No_Import"), + profile_); } else { int browser_selected = import_from_combo_->selected_item(); FirstRun::ImportSettings(profile_, diff --git a/chrome/browser/views/first_run_view.cc b/chrome/browser/views/first_run_view.cc index 8a0ffe9..2ba4bcd 100644 --- a/chrome/browser/views/first_run_view.cc +++ b/chrome/browser/views/first_run_view.cc @@ -190,7 +190,7 @@ bool FirstRunView::Accept() { FirstRun::ImportSettings(profile_, importer_host_->GetSourceProfileInfoAt(0).browser_type, GetImportItems(), window()->GetNativeWindow()); - UserMetrics::RecordAction("FirstRunDef_Accept", profile_); + UserMetrics::RecordAction(UserMetricsAction("FirstRunDef_Accept"), profile_); if (default_browser_ && default_browser_->checked()) SetDefaultBrowser(); @@ -201,7 +201,7 @@ bool FirstRunView::Accept() { } bool FirstRunView::Cancel() { - UserMetrics::RecordAction("FirstRunDef_Cancel", profile_); + UserMetrics::RecordAction(UserMetricsAction("FirstRunDef_Cancel"), profile_); MessageLoop::current()->PostTask(FROM_HERE, new MessageLoop::QuitTask()); return true; } @@ -215,5 +215,6 @@ void FirstRunView::CustomizeAccepted() { // Notification from the customize dialog that the user cancelled. void FirstRunView::CustomizeCanceled() { - UserMetrics::RecordAction("FirstRunCustom_Cancel", profile_); + UserMetrics::RecordAction(UserMetricsAction("FirstRunCustom_Cancel"), + profile_); } diff --git a/chrome/browser/views/first_run_view_base.cc b/chrome/browser/views/first_run_view_base.cc index c29ab39..c83b20e 100644 --- a/chrome/browser/views/first_run_view_base.cc +++ b/chrome/browser/views/first_run_view_base.cc @@ -241,7 +241,8 @@ bool FirstRunViewBase::CreateQuickLaunchShortcut() { } bool FirstRunViewBase::SetDefaultBrowser() { - UserMetrics::RecordAction("FirstRun_Do_DefBrowser", profile_); + UserMetrics::RecordAction(UserMetricsAction("FirstRun_Do_DefBrowser"), + profile_); return ShellIntegration::SetAsDefaultBrowser(); } diff --git a/chrome/browser/views/options/advanced_contents_view.cc b/chrome/browser/views/options/advanced_contents_view.cc index 977c425..4594165 100644 --- a/chrome/browser/views/options/advanced_contents_view.cc +++ b/chrome/browser/views/options/advanced_contents_view.cc @@ -506,31 +506,31 @@ void PrivacySection::ButtonPressed( views::Button* sender, const views::Event& event) { if (sender == enable_link_doctor_checkbox_) { bool enabled = enable_link_doctor_checkbox_->checked(); - UserMetricsRecordAction(enabled ? + UserMetricsRecordAction(UserMetricsAction(enabled ? "Options_LinkDoctorCheckbox_Enable" : - "Options_LinkDoctorCheckbox_Disable", + "Options_LinkDoctorCheckbox_Disable"), profile()->GetPrefs()); alternate_error_pages_.SetValue(enabled); } else if (sender == enable_suggest_checkbox_) { bool enabled = enable_suggest_checkbox_->checked(); - UserMetricsRecordAction(enabled ? + UserMetricsRecordAction(UserMetricsAction(enabled ? "Options_UseSuggestCheckbox_Enable" : - "Options_UseSuggestCheckbox_Disable", + "Options_UseSuggestCheckbox_Disable"), profile()->GetPrefs()); use_suggest_.SetValue(enabled); } else if (sender == enable_dns_prefetching_checkbox_) { bool enabled = enable_dns_prefetching_checkbox_->checked(); - UserMetricsRecordAction(enabled ? + UserMetricsRecordAction(UserMetricsAction(enabled ? "Options_DnsPrefetchCheckbox_Enable" : - "Options_DnsPrefetchCheckbox_Disable", + "Options_DnsPrefetchCheckbox_Disable"), profile()->GetPrefs()); dns_prefetch_enabled_.SetValue(enabled); chrome_browser_net::EnableDnsPrefetch(enabled); } else if (sender == enable_safe_browsing_checkbox_) { bool enabled = enable_safe_browsing_checkbox_->checked(); - UserMetricsRecordAction(enabled ? + UserMetricsRecordAction(UserMetricsAction(enabled ? "Options_SafeBrowsingCheckbox_Enable" : - "Options_SafeBrowsingCheckbox_Disable", + "Options_SafeBrowsingCheckbox_Disable"), profile()->GetPrefs()); safe_browsing_.SetValue(enabled); SafeBrowsingService* safe_browsing_service = @@ -540,20 +540,20 @@ void PrivacySection::ButtonPressed( } else if (reporting_enabled_checkbox_ && (sender == reporting_enabled_checkbox_)) { bool enabled = reporting_enabled_checkbox_->checked(); - UserMetricsRecordAction(enabled ? + UserMetricsRecordAction(UserMetricsAction(enabled ? "Options_MetricsReportingCheckbox_Enable" : - "Options_MetricsReportingCheckbox_Disable", + "Options_MetricsReportingCheckbox_Disable"), profile()->GetPrefs()); ResolveMetricsReportingEnabled(); if (enabled == reporting_enabled_checkbox_->checked()) RestartMessageBox::ShowMessageBox(GetWindow()->GetNativeWindow()); enable_metrics_recording_.SetValue(enabled); } else if (sender == content_settings_button_) { - UserMetricsRecordAction("Options_ContentSettings", NULL); + UserMetricsRecordAction(UserMetricsAction("Options_ContentSettings"), NULL); browser::ShowContentSettingsWindow(GetWindow()->GetNativeWindow(), CONTENT_SETTINGS_TYPE_DEFAULT, profile()); } else if (sender == clear_data_button_) { - UserMetricsRecordAction("Options_ClearData", NULL); + UserMetricsRecordAction(UserMetricsAction("Options_ClearData"), NULL); views::Window::CreateChromeWindow( GetWindow()->GetNativeWindow(), gfx::Rect(), @@ -744,7 +744,7 @@ WebContentSection::WebContentSection(Profile* profile) void WebContentSection::ButtonPressed( views::Button* sender, const views::Event& event) { if (sender == gears_settings_button_) { - UserMetricsRecordAction("Options_GearsSettings", NULL); + UserMetricsRecordAction(UserMetricsAction("Options_GearsSettings"), NULL); GearsSettingsPressed(GetAncestor(GetWidget()->GetNativeView(), GA_ROOT)); } else if (sender == change_content_fonts_button_) { views::Window::CreateChromeWindow( @@ -845,21 +845,23 @@ void SecuritySection::ButtonPressed( if (sender == enable_ssl2_checkbox_) { bool enabled = enable_ssl2_checkbox_->checked(); if (enabled) { - UserMetricsRecordAction("Options_SSL2_Enable", NULL); + UserMetricsRecordAction(UserMetricsAction("Options_SSL2_Enable"), NULL); } else { - UserMetricsRecordAction("Options_SSL2_Disable", NULL); + UserMetricsRecordAction(UserMetricsAction("Options_SSL2_Disable"), NULL); } net::SSLConfigServiceWin::SetSSL2Enabled(enabled); } else if (sender == check_for_cert_revocation_checkbox_) { bool enabled = check_for_cert_revocation_checkbox_->checked(); if (enabled) { - UserMetricsRecordAction("Options_CheckCertRevocation_Enable", NULL); + UserMetricsRecordAction( + UserMetricsAction("Options_CheckCertRevocation_Enable"), NULL); } else { - UserMetricsRecordAction("Options_CheckCertRevocation_Disable", NULL); + UserMetricsRecordAction( + UserMetricsAction("Options_CheckCertRevocation_Disable"), NULL); } net::SSLConfigServiceWin::SetRevCheckingEnabled(enabled); } else if (sender == manage_certificates_button_) { - UserMetricsRecordAction("Options_ManagerCerts", NULL); + UserMetricsRecordAction(UserMetricsAction("Options_ManagerCerts"), NULL); CRYPTUI_CERT_MGR_STRUCT cert_mgr = { 0 }; cert_mgr.dwSize = sizeof(CRYPTUI_CERT_MGR_STRUCT); cert_mgr.hwndParent = GetWindow()->GetNativeWindow(); @@ -995,7 +997,7 @@ NetworkSection::NetworkSection(Profile* profile) void NetworkSection::ButtonPressed( views::Button* sender, const views::Event& event) { if (sender == change_proxies_button_) { - UserMetricsRecordAction("Options_ChangeProxies", NULL); + UserMetricsRecordAction(UserMetricsAction("Options_ChangeProxies"), NULL); base::Thread* thread = g_browser_process->file_thread(); DCHECK(thread); thread->message_loop()->PostTask(FROM_HERE, new OpenConnectionDialogTask); @@ -1112,23 +1114,25 @@ void DownloadSection::ButtonPressed( } else if (sender == download_ask_for_save_location_checkbox_) { bool enabled = download_ask_for_save_location_checkbox_->checked(); if (enabled) { - UserMetricsRecordAction("Options_AskForSaveLocation_Enable", - profile()->GetPrefs()); + UserMetricsRecordAction( + UserMetricsAction("Options_AskForSaveLocation_Enable"), + profile()->GetPrefs()); } else { - UserMetricsRecordAction("Options_AskForSaveLocation_Disable", - profile()->GetPrefs()); + UserMetricsRecordAction( + UserMetricsAction("Options_AskForSaveLocation_Disable"), + profile()->GetPrefs()); } ask_for_save_location_.SetValue(enabled); } else if (sender == reset_file_handlers_button_) { profile()->GetDownloadManager()->ResetAutoOpenFiles(); - UserMetricsRecordAction("Options_ResetAutoOpenFiles", + UserMetricsRecordAction(UserMetricsAction("Options_ResetAutoOpenFiles"), profile()->GetPrefs()); } } void DownloadSection::FileSelected(const FilePath& path, int index, void* params) { - UserMetricsRecordAction("Options_SetDownloadDirectory", + UserMetricsRecordAction(UserMetricsAction("Options_SetDownloadDirectory"), profile()->GetPrefs()); default_download_location_.SetValue(path.ToWStringHack()); // We need to call this manually here since because we're setting the value @@ -1252,7 +1256,7 @@ class TranslateSection : public AdvancedSection, // Preferences for this section: BooleanPrefMember enable_translate_; - DISALLOW_COPY_AND_ASSIGN(TranslateSection ); + DISALLOW_COPY_AND_ASSIGN(TranslateSection); }; TranslateSection::TranslateSection(Profile* profile) @@ -1265,8 +1269,9 @@ void TranslateSection::ButtonPressed( views::Button* sender, const views::Event& event) { DCHECK(sender == enable_translate_checkbox_); bool enabled = enable_translate_checkbox_->checked(); - UserMetricsRecordAction(enabled ? "Options_Translate_Enable" : - "Options_Translate_Disable", + UserMetricsRecordAction(enabled ? + UserMetricsAction("Options_Translate_Enable") : + UserMetricsAction("Options_Translate_Disable"), profile()->GetPrefs()); enable_translate_.SetValue(enabled); } diff --git a/chrome/browser/views/options/advanced_page_view.cc b/chrome/browser/views/options/advanced_page_view.cc index 65114e7..6d98fdd 100644 --- a/chrome/browser/views/options/advanced_page_view.cc +++ b/chrome/browser/views/options/advanced_page_view.cc @@ -105,9 +105,10 @@ void AdvancedPageView::ResetToDefaults() { void AdvancedPageView::ButtonPressed( views::Button* sender, const views::Event& event) { if (sender == reset_to_default_button_) { - UserMetricsRecordAction("Options_ResetToDefaults", NULL); - ResetDefaultsConfirmBox::ShowConfirmBox( - GetWindow()->GetNativeWindow(), this); + UserMetricsRecordAction(UserMetricsAction("Options_ResetToDefaults"), + NULL); + ResetDefaultsConfirmBox::ShowConfirmBox( + GetWindow()->GetNativeWindow(), this); } } diff --git a/chrome/browser/views/options/content_page_view.cc b/chrome/browser/views/options/content_page_view.cc index addd3af..3db7163 100644 --- a/chrome/browser/views/options/content_page_view.cc +++ b/chrome/browser/views/options/content_page_view.cc @@ -87,26 +87,29 @@ void ContentPageView::ButtonPressed( sender == passwords_neversave_radio_) { bool enabled = passwords_asktosave_radio_->checked(); if (enabled) { - UserMetricsRecordAction("Options_PasswordManager_Enable", - profile()->GetPrefs()); + UserMetricsRecordAction( + UserMetricsAction("Options_PasswordManager_Enable"), + profile()->GetPrefs()); } else { - UserMetricsRecordAction("Options_PasswordManager_Disable", - profile()->GetPrefs()); + UserMetricsRecordAction( + UserMetricsAction("Options_PasswordManager_Disable"), + profile()->GetPrefs()); } ask_to_save_passwords_.SetValue(enabled); } else if (sender == form_autofill_enable_radio_ || sender == form_autofill_disable_radio_) { bool enabled = form_autofill_enable_radio_->checked(); if (enabled) { - UserMetricsRecordAction("Options_FormAutofill_Enable", + UserMetricsRecordAction(UserMetricsAction("Options_FormAutofill_Enable"), profile()->GetPrefs()); } else { - UserMetricsRecordAction("Options_FormAutofill_Disable", + UserMetricsRecordAction(UserMetricsAction("Options_FormAutofill_Disable"), profile()->GetPrefs()); } ask_to_save_form_autofill_.SetValue(enabled); } else if (sender == show_passwords_button_) { - UserMetricsRecordAction("Options_ShowPasswordsExceptions", NULL); + UserMetricsRecordAction( + UserMetricsAction("Options_ShowPasswordsExceptions"), NULL); PasswordsExceptionsWindowView::Show(profile()); } else if (sender == change_autofill_settings_button_) { // This button should be disabled if we lack PersonalDataManager. @@ -115,7 +118,8 @@ void ContentPageView::ButtonPressed( profile()->GetPersonalDataManager(), profile()); } else if (sender == themes_reset_button_) { - UserMetricsRecordAction("Options_ThemesReset", profile()->GetPrefs()); + UserMetricsRecordAction(UserMetricsAction("Options_ThemesReset"), + profile()->GetPrefs()); profile()->ClearTheme(); } else if (sender == import_button_) { views::Window::CreateChromeWindow( @@ -146,7 +150,8 @@ void ContentPageView::ButtonPressed( void ContentPageView::LinkActivated(views::Link* source, int event_flags) { if (source == themes_gallery_link_) { - UserMetricsRecordAction("Options_ThemesGallery", profile()->GetPrefs()); + UserMetricsRecordAction(UserMetricsAction("Options_ThemesGallery"), + profile()->GetPrefs()); BrowserList::GetLastActive()->OpenThemeGalleryTabAndActivate(); return; } diff --git a/chrome/browser/views/options/cookie_filter_page_view.cc b/chrome/browser/views/options/cookie_filter_page_view.cc index 9bdef63..10efde1 100644 --- a/chrome/browser/views/options/cookie_filter_page_view.cc +++ b/chrome/browser/views/options/cookie_filter_page_view.cc @@ -186,7 +186,7 @@ void CookieFilterPageView::ButtonPressed( clear_site_data_on_exit_.SetValue(clear_on_close_check_->checked()); } else { DCHECK_EQ(sender, show_cookies_button_); - UserMetricsRecordAction("Options_ShowCookies", NULL); + UserMetricsRecordAction(UserMetricsAction("Options_ShowCookies"), NULL); CookiesView::ShowCookiesWindow(profile()); } } diff --git a/chrome/browser/views/options/general_page_view.cc b/chrome/browser/views/options/general_page_view.cc index ecd0a1d..9cfc14f 100644 --- a/chrome/browser/views/options/general_page_view.cc +++ b/chrome/browser/views/options/general_page_view.cc @@ -437,13 +437,13 @@ void GeneralPageView::ButtonPressed( sender == startup_custom_radio_) { SaveStartupPref(); if (sender == startup_homepage_radio_) { - UserMetricsRecordAction("Options_Startup_Homepage", + UserMetricsRecordAction(UserMetricsAction("Options_Startup_Homepage"), profile()->GetPrefs()); } else if (sender == startup_last_session_radio_) { - UserMetricsRecordAction("Options_Startup_LastSession", + UserMetricsRecordAction(UserMetricsAction("Options_Startup_LastSession"), profile()->GetPrefs()); } else if (sender == startup_custom_radio_) { - UserMetricsRecordAction("Options_Startup_Custom", + UserMetricsRecordAction(UserMetricsAction("Options_Startup_Custom"), profile()->GetPrefs()); } } else if (sender == startup_add_custom_page_button_) { @@ -453,33 +453,37 @@ void GeneralPageView::ButtonPressed( } else if (sender == startup_use_current_page_button_) { SetStartupURLToCurrentPage(); } else if (sender == homepage_use_newtab_radio_) { - UserMetricsRecordAction("Options_Homepage_UseNewTab", + UserMetricsRecordAction(UserMetricsAction("Options_Homepage_UseNewTab"), profile()->GetPrefs()); SetHomepage(GetNewTabUIURLString()); EnableHomepageURLField(false); } else if (sender == homepage_use_url_radio_) { - UserMetricsRecordAction("Options_Homepage_UseURL", + UserMetricsRecordAction(UserMetricsAction("Options_Homepage_UseURL"), profile()->GetPrefs()); SetHomepage(homepage_use_url_textfield_->text()); EnableHomepageURLField(true); } else if (sender == homepage_show_home_button_checkbox_) { bool show_button = homepage_show_home_button_checkbox_->checked(); if (show_button) { - UserMetricsRecordAction("Options_Homepage_ShowHomeButton", - profile()->GetPrefs()); + UserMetricsRecordAction( + UserMetricsAction("Options_Homepage_ShowHomeButton"), + profile()->GetPrefs()); } else { - UserMetricsRecordAction("Options_Homepage_HideHomeButton", - profile()->GetPrefs()); + UserMetricsRecordAction( + UserMetricsAction("Options_Homepage_HideHomeButton"), + profile()->GetPrefs()); } show_home_button_.SetValue(show_button); } else if (sender == default_browser_use_as_default_button_) { default_browser_worker_->StartSetAsDefaultBrowser(); - UserMetricsRecordAction("Options_SetAsDefaultBrowser", NULL); + UserMetricsRecordAction(UserMetricsAction("Options_SetAsDefaultBrowser"), + NULL); // If the user made Chrome the default browser, then he/she arguably wants // to be notified when that changes. profile()->GetPrefs()->SetBoolean(prefs::kCheckDefaultBrowser, true); } else if (sender == default_search_manage_engines_button_) { - UserMetricsRecordAction("Options_ManageSearchEngines", NULL); + UserMetricsRecordAction(UserMetricsAction("Options_ManageSearchEngines"), + NULL); KeywordEditorView::Show(profile()); } } @@ -491,7 +495,8 @@ void GeneralPageView::ItemChanged(views::Combobox* combobox, int prev_index, int new_index) { if (combobox == default_search_engine_combobox_) { SetDefaultSearchProvider(); - UserMetricsRecordAction("Options_SearchEngineChanged", NULL); + UserMetricsRecordAction(UserMetricsAction("Options_SearchEngineChanged"), + NULL); } } diff --git a/chrome/browser/views/options/languages_page_view.cc b/chrome/browser/views/options/languages_page_view.cc index cb76b39..13dbb20 100644 --- a/chrome/browser/views/options/languages_page_view.cc +++ b/chrome/browser/views/options/languages_page_view.cc @@ -551,7 +551,7 @@ void LanguagesPageView::SaveChanges() { } if (ui_language_index_selected_ != -1) { - UserMetricsRecordAction("Options_AppLanguage", + UserMetricsRecordAction(UserMetricsAction("Options_AppLanguage"), g_browser_process->local_state()); app_locale_.SetValue(ASCIIToWide(ui_language_model_-> GetLocaleFromIndex(ui_language_index_selected_))); @@ -563,7 +563,7 @@ void LanguagesPageView::SaveChanges() { } if (spellcheck_language_index_selected_ != -1) { - UserMetricsRecordAction("Options_DictionaryLanguage", + UserMetricsRecordAction(UserMetricsAction("Options_DictionaryLanguage"), profile()->GetPrefs()); dictionary_language_.SetValue(ASCIIToWide(dictionary_language_model_-> GetLocaleFromIndex(spellcheck_language_index_selected_))); diff --git a/chrome/browser/views/tabs/dragged_tab_controller.cc b/chrome/browser/views/tabs/dragged_tab_controller.cc index dde0267..ce26ac7 100644 --- a/chrome/browser/views/tabs/dragged_tab_controller.cc +++ b/chrome/browser/views/tabs/dragged_tab_controller.cc @@ -1086,43 +1086,45 @@ bool DraggedTabController::CompleteDrag() { if (dock_info_.type() != DockInfo::NONE) { switch (dock_info_.type()) { case DockInfo::LEFT_OF_WINDOW: - UserMetrics::RecordAction("DockingWindow_Left", + UserMetrics::RecordAction(UserMetricsAction("DockingWindow_Left"), source_tabstrip_->model()->profile()); break; case DockInfo::RIGHT_OF_WINDOW: - UserMetrics::RecordAction("DockingWindow_Right", + UserMetrics::RecordAction(UserMetricsAction("DockingWindow_Right"), source_tabstrip_->model()->profile()); break; case DockInfo::BOTTOM_OF_WINDOW: - UserMetrics::RecordAction("DockingWindow_Bottom", + UserMetrics::RecordAction(UserMetricsAction("DockingWindow_Bottom"), source_tabstrip_->model()->profile()); break; case DockInfo::TOP_OF_WINDOW: - UserMetrics::RecordAction("DockingWindow_Top", + UserMetrics::RecordAction(UserMetricsAction("DockingWindow_Top"), source_tabstrip_->model()->profile()); break; case DockInfo::MAXIMIZE: - UserMetrics::RecordAction("DockingWindow_Maximize", + UserMetrics::RecordAction(UserMetricsAction("DockingWindow_Maximize"), source_tabstrip_->model()->profile()); break; case DockInfo::LEFT_HALF: - UserMetrics::RecordAction("DockingWindow_LeftHalf", + UserMetrics::RecordAction(UserMetricsAction("DockingWindow_LeftHalf"), source_tabstrip_->model()->profile()); break; case DockInfo::RIGHT_HALF: - UserMetrics::RecordAction("DockingWindow_RightHalf", - source_tabstrip_->model()->profile()); + UserMetrics::RecordAction( + UserMetricsAction("DockingWindow_RightHalf"), + source_tabstrip_->model()->profile()); break; case DockInfo::BOTTOM_HALF: - UserMetrics::RecordAction("DockingWindow_BottomHalf", - source_tabstrip_->model()->profile()); + UserMetrics::RecordAction( + UserMetricsAction("DockingWindow_BottomHalf"), + source_tabstrip_->model()->profile()); break; default: diff --git a/chrome/browser/views/tabs/tab_strip.cc b/chrome/browser/views/tabs/tab_strip.cc index 6edd1e4..c3da175 100644 --- a/chrome/browser/views/tabs/tab_strip.cc +++ b/chrome/browser/views/tabs/tab_strip.cc @@ -1043,7 +1043,8 @@ int TabStrip::OnPerformDrop(const DropTargetEvent& event) { return DragDropTypes::DRAG_NONE; if (drop_before) { - UserMetrics::RecordAction("Tab_DropURLBetweenTabs", model_->profile()); + UserMetrics::RecordAction(UserMetricsAction("Tab_DropURLBetweenTabs"), + model_->profile()); // Insert a new tab. TabContents* contents = @@ -1053,7 +1054,8 @@ int TabStrip::OnPerformDrop(const DropTargetEvent& event) { model_->AddTabContents(contents, drop_index, false, PageTransition::GENERATED, true); } else { - UserMetrics::RecordAction("Tab_DropURLOnTab", model_->profile()); + UserMetrics::RecordAction(UserMetricsAction("Tab_DropURLOnTab"), + model_->profile()); model_->GetTabContentsAt(drop_index)->controller().LoadURL( url, GURL(), PageTransition::GENERATED); @@ -1295,7 +1297,8 @@ void TabStrip::CloseTab(Tab* tab) { if (model_->ContainsIndex(tab_index)) { TabContents* contents = model_->GetTabContentsAt(tab_index); if (contents) - UserMetrics::RecordAction("CloseTab_Mouse", contents->profile()); + UserMetrics::RecordAction(UserMetricsAction("CloseTab_Mouse"), + contents->profile()); Tab* last_tab = GetTabAt(GetTabCount() - 1); // Limit the width available to the TabStrip for laying out Tabs, so that // Tabs are not resized until a later time (when the mouse pointer leaves @@ -1417,7 +1420,8 @@ void TabStrip::ButtonPressed(views::Button* sender, const views::Event& event) { AppLauncher::Show(Browser::GetBrowserForController(&controller, NULL)); return; } - UserMetrics::RecordAction("NewTab_Button", model_->profile()); + UserMetrics::RecordAction(UserMetricsAction("NewTab_Button"), + model_->profile()); model_->delegate()->AddBlankTab(true); } } diff --git a/chrome/browser/views/toolbar_view.cc b/chrome/browser/views/toolbar_view.cc index a771c98..a640442 100644 --- a/chrome/browser/views/toolbar_view.cc +++ b/chrome/browser/views/toolbar_view.cc @@ -483,7 +483,7 @@ void ToolbarView::WriteDragData(views::View* sender, OSExchangeData* data) { DCHECK(GetDragOperations(sender, press_pt) != DragDropTypes::DRAG_NONE); - UserMetrics::RecordAction("Toolbar_DragStar", profile_); + UserMetrics::RecordAction(UserMetricsAction("Toolbar_DragStar"), profile_); // If there is a bookmark for the URL, add the bookmark drag data for it. We // do this to ensure the bookmark is moved, rather than creating an new |