Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1172)

Unified Diff: chrome/browser/ui/browser_commands.cc

Issue 2771233002: Remove the wrapper functions content::RecordAction et al (Closed)
Patch Set: Rebased Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/browser_command_controller.cc ('k') | chrome/browser/ui/browser_commands_chromeos.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/browser_commands.cc
diff --git a/chrome/browser/ui/browser_commands.cc b/chrome/browser/ui/browser_commands.cc
index efcc39cc4d372d674a7f6f303bf3f5334abefc80..e7622b84c156f326d3d36f05ad09f9ad926f31ad 100644
--- a/chrome/browser/ui/browser_commands.cc
+++ b/chrome/browser/ui/browser_commands.cc
@@ -6,6 +6,7 @@
#include "base/command_line.h"
#include "base/metrics/histogram_macros.h"
+#include "base/metrics/user_metrics.h"
#include "base/strings/utf_string_conversions.h"
#include "build/build_config.h"
#include "chrome/app/chrome_command_ids.h"
@@ -78,7 +79,6 @@
#include "content/public/browser/page_navigator.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/render_widget_host_view.h"
-#include "content/public/browser/user_metrics.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/page_state.h"
#include "content/public/common/renderer_preferences.h"
@@ -378,10 +378,10 @@ void NewEmptyWindow(Profile* profile) {
}
if (incognito) {
- content::RecordAction(UserMetricsAction("NewIncognitoWindow"));
+ base::RecordAction(UserMetricsAction("NewIncognitoWindow"));
OpenEmptyWindow(profile->GetOffTheRecordProfile());
} else {
- content::RecordAction(UserMetricsAction("NewWindow"));
+ base::RecordAction(UserMetricsAction("NewWindow"));
SessionService* session_service =
SessionServiceFactory::GetForProfileForSessionRestore(
profile->GetOriginalProfile());
@@ -420,7 +420,7 @@ bool CanGoBack(const Browser* browser) {
}
void GoBack(Browser* browser, WindowOpenDisposition disposition) {
- content::RecordAction(UserMetricsAction("Back"));
+ base::RecordAction(UserMetricsAction("Back"));
if (CanGoBack(browser)) {
WebContents* current_tab =
@@ -439,7 +439,7 @@ bool CanGoForward(const Browser* browser) {
}
void GoForward(Browser* browser, WindowOpenDisposition disposition) {
- content::RecordAction(UserMetricsAction("Forward"));
+ base::RecordAction(UserMetricsAction("Forward"));
if (CanGoForward(browser)) {
GetTabAndRevertIfNecessary(browser, disposition)->
GetController().GoForward();
@@ -458,12 +458,12 @@ bool NavigateToIndexWithDisposition(Browser* browser,
}
void Reload(Browser* browser, WindowOpenDisposition disposition) {
- content::RecordAction(UserMetricsAction("Reload"));
+ base::RecordAction(UserMetricsAction("Reload"));
ReloadInternal(browser, disposition, false);
}
void ReloadBypassingCache(Browser* browser, WindowOpenDisposition disposition) {
- content::RecordAction(UserMetricsAction("ReloadBypassingCache"));
+ base::RecordAction(UserMetricsAction("ReloadBypassingCache"));
ReloadInternal(browser, disposition, true);
}
@@ -472,7 +472,7 @@ bool CanReload(const Browser* browser) {
}
void Home(Browser* browser, WindowOpenDisposition disposition) {
- content::RecordAction(UserMetricsAction("Home"));
+ base::RecordAction(UserMetricsAction("Home"));
std::string extra_headers;
#if BUILDFLAG(ENABLE_RLZ)
@@ -520,7 +520,7 @@ void Home(Browser* browser, WindowOpenDisposition disposition) {
}
void OpenCurrentURL(Browser* browser) {
- content::RecordAction(UserMetricsAction("LoadURL"));
+ base::RecordAction(UserMetricsAction("LoadURL"));
LocationBar* location_bar = browser->window()->GetLocationBar();
if (!location_bar)
return;
@@ -569,7 +569,7 @@ void OpenCurrentURL(Browser* browser) {
}
void Stop(Browser* browser) {
- content::RecordAction(UserMetricsAction("Stop"));
+ base::RecordAction(UserMetricsAction("Stop"));
browser->tab_strip_model()->GetActiveWebContents()->Stop();
}
@@ -582,12 +582,12 @@ void NewIncognitoWindow(Browser* browser) {
}
void CloseWindow(Browser* browser) {
- content::RecordAction(UserMetricsAction("CloseWindow"));
+ base::RecordAction(UserMetricsAction("CloseWindow"));
browser->window()->Close();
}
void NewTab(Browser* browser) {
- content::RecordAction(UserMetricsAction("NewTab"));
+ base::RecordAction(UserMetricsAction("NewTab"));
// TODO(asvitkine): This is invoked programmatically from several places.
// Audit the code and change it so that the histogram only gets collected for
// user-initiated commands.
@@ -610,7 +610,7 @@ void NewTab(Browser* browser) {
}
void CloseTab(Browser* browser) {
- content::RecordAction(UserMetricsAction("CloseTab_Accelerator"));
+ base::RecordAction(UserMetricsAction("CloseTab_Accelerator"));
browser->tab_strip_model()->CloseSelectedTabs();
}
@@ -645,39 +645,39 @@ TabStripModelDelegate::RestoreTabType GetRestoreTabType(
}
void SelectNextTab(Browser* browser) {
- content::RecordAction(UserMetricsAction("SelectNextTab"));
+ base::RecordAction(UserMetricsAction("SelectNextTab"));
browser->tab_strip_model()->SelectNextTab();
}
void SelectPreviousTab(Browser* browser) {
- content::RecordAction(UserMetricsAction("SelectPrevTab"));
+ base::RecordAction(UserMetricsAction("SelectPrevTab"));
browser->tab_strip_model()->SelectPreviousTab();
}
void MoveTabNext(Browser* browser) {
- content::RecordAction(UserMetricsAction("MoveTabNext"));
+ base::RecordAction(UserMetricsAction("MoveTabNext"));
browser->tab_strip_model()->MoveTabNext();
}
void MoveTabPrevious(Browser* browser) {
- content::RecordAction(UserMetricsAction("MoveTabPrevious"));
+ base::RecordAction(UserMetricsAction("MoveTabPrevious"));
browser->tab_strip_model()->MoveTabPrevious();
}
void SelectNumberedTab(Browser* browser, int index) {
if (index < browser->tab_strip_model()->count()) {
- content::RecordAction(UserMetricsAction("SelectNumberedTab"));
+ base::RecordAction(UserMetricsAction("SelectNumberedTab"));
browser->tab_strip_model()->ActivateTabAt(index, true);
}
}
void SelectLastTab(Browser* browser) {
- content::RecordAction(UserMetricsAction("SelectLastTab"));
+ base::RecordAction(UserMetricsAction("SelectLastTab"));
browser->tab_strip_model()->SelectLastTab();
}
void DuplicateTab(Browser* browser) {
- content::RecordAction(UserMetricsAction("Duplicate"));
+ base::RecordAction(UserMetricsAction("Duplicate"));
DuplicateTabAt(browser, browser->tab_strip_model()->active_index());
}
@@ -745,7 +745,7 @@ bool CanDuplicateTabAt(const Browser* browser, int index) {
}
void ConvertPopupToTabbedBrowser(Browser* browser) {
- content::RecordAction(UserMetricsAction("ShowAsTab"));
+ base::RecordAction(UserMetricsAction("ShowAsTab"));
TabStripModel* tab_strip = browser->tab_strip_model();
WebContents* contents =
tab_strip->DetachWebContentsAt(tab_strip->active_index());
@@ -755,12 +755,12 @@ void ConvertPopupToTabbedBrowser(Browser* browser) {
}
void Exit() {
- content::RecordAction(UserMetricsAction("Exit"));
+ base::RecordAction(UserMetricsAction("Exit"));
chrome::AttemptUserExit();
}
void BookmarkCurrentPageIgnoringExtensionOverrides(Browser* browser) {
- content::RecordAction(UserMetricsAction("Star"));
+ base::RecordAction(UserMetricsAction("Star"));
BookmarkModel* model =
BookmarkModelFactory::GetForBrowserContext(browser->profile());
@@ -825,7 +825,7 @@ bool CanBookmarkCurrentPage(const Browser* browser) {
}
void BookmarkAllTabs(Browser* browser) {
- content::RecordAction(UserMetricsAction("BookmarkAllTabs"));
+ base::RecordAction(UserMetricsAction("BookmarkAllTabs"));
chrome::ShowBookmarkAllTabsDialog(browser);
}
@@ -875,10 +875,10 @@ void ManagePasswordsForPage(Browser* browser) {
}
void SavePage(Browser* browser) {
- content::RecordAction(UserMetricsAction("SavePage"));
+ base::RecordAction(UserMetricsAction("SavePage"));
WebContents* current_tab = browser->tab_strip_model()->GetActiveWebContents();
if (current_tab && current_tab->GetContentsMimeType() == "application/pdf")
- content::RecordAction(UserMetricsAction("PDF.SavePage"));
+ base::RecordAction(UserMetricsAction("PDF.SavePage"));
current_tab->OnSavePage();
}
@@ -977,7 +977,7 @@ void RouteMedia(Browser* browser) {
}
void EmailPageLocation(Browser* browser) {
- content::RecordAction(UserMetricsAction("EmailPageLocation"));
+ base::RecordAction(UserMetricsAction("EmailPageLocation"));
WebContents* wc = browser->tab_strip_model()->GetActiveWebContents();
DCHECK(wc);
@@ -996,26 +996,26 @@ bool CanEmailPageLocation(const Browser* browser) {
void CutCopyPaste(Browser* browser, int command_id) {
if (command_id == IDC_CUT)
- content::RecordAction(UserMetricsAction("Cut"));
+ base::RecordAction(UserMetricsAction("Cut"));
else if (command_id == IDC_COPY)
- content::RecordAction(UserMetricsAction("Copy"));
+ base::RecordAction(UserMetricsAction("Copy"));
else
- content::RecordAction(UserMetricsAction("Paste"));
+ base::RecordAction(UserMetricsAction("Paste"));
browser->window()->CutCopyPaste(command_id);
}
void Find(Browser* browser) {
- content::RecordAction(UserMetricsAction("Find"));
+ base::RecordAction(UserMetricsAction("Find"));
FindInPage(browser, false, false);
}
void FindNext(Browser* browser) {
- content::RecordAction(UserMetricsAction("FindNext"));
+ base::RecordAction(UserMetricsAction("FindNext"));
FindInPage(browser, true, true);
}
void FindPrevious(Browser* browser) {
- content::RecordAction(UserMetricsAction("FindPrevious"));
+ base::RecordAction(UserMetricsAction("FindPrevious"));
FindInPage(browser, true, false);
}
@@ -1043,51 +1043,51 @@ void Zoom(Browser* browser, content::PageZoom zoom) {
}
void FocusToolbar(Browser* browser) {
- content::RecordAction(UserMetricsAction("FocusToolbar"));
+ base::RecordAction(UserMetricsAction("FocusToolbar"));
browser->window()->FocusToolbar();
}
void FocusLocationBar(Browser* browser) {
- content::RecordAction(UserMetricsAction("FocusLocation"));
+ base::RecordAction(UserMetricsAction("FocusLocation"));
browser->window()->SetFocusToLocationBar(true);
}
void FocusSearch(Browser* browser) {
// TODO(beng): replace this with FocusLocationBar
- content::RecordAction(UserMetricsAction("FocusSearch"));
+ base::RecordAction(UserMetricsAction("FocusSearch"));
browser->window()->GetLocationBar()->FocusSearch();
}
void FocusAppMenu(Browser* browser) {
- content::RecordAction(UserMetricsAction("FocusAppMenu"));
+ base::RecordAction(UserMetricsAction("FocusAppMenu"));
browser->window()->FocusAppMenu();
}
void FocusBookmarksToolbar(Browser* browser) {
- content::RecordAction(UserMetricsAction("FocusBookmarksToolbar"));
+ base::RecordAction(UserMetricsAction("FocusBookmarksToolbar"));
browser->window()->FocusBookmarksToolbar();
}
void FocusInfobars(Browser* browser) {
- content::RecordAction(UserMetricsAction("FocusInfobars"));
+ base::RecordAction(UserMetricsAction("FocusInfobars"));
browser->window()->FocusInfobars();
}
void FocusNextPane(Browser* browser) {
- content::RecordAction(UserMetricsAction("FocusNextPane"));
+ base::RecordAction(UserMetricsAction("FocusNextPane"));
browser->window()->RotatePaneFocus(true);
}
void FocusPreviousPane(Browser* browser) {
- content::RecordAction(UserMetricsAction("FocusPreviousPane"));
+ base::RecordAction(UserMetricsAction("FocusPreviousPane"));
browser->window()->RotatePaneFocus(false);
}
void ToggleDevToolsWindow(Browser* browser, DevToolsToggleAction action) {
if (action.type() == DevToolsToggleAction::kShowConsolePanel)
- content::RecordAction(UserMetricsAction("DevTools_ToggleConsole"));
+ base::RecordAction(UserMetricsAction("DevTools_ToggleConsole"));
else
- content::RecordAction(UserMetricsAction("DevTools_ToggleWindow"));
+ base::RecordAction(UserMetricsAction("DevTools_ToggleWindow"));
DevToolsWindow::ToggleDevToolsWindow(browser, action);
}
@@ -1101,7 +1101,7 @@ bool CanOpenTaskManager() {
void OpenTaskManager(Browser* browser) {
#if !defined(OS_ANDROID)
- content::RecordAction(UserMetricsAction("TaskManager"));
+ base::RecordAction(UserMetricsAction("TaskManager"));
chrome::ShowTaskManager(browser);
#else
NOTREACHED();
@@ -1109,12 +1109,12 @@ void OpenTaskManager(Browser* browser) {
}
void OpenFeedbackDialog(Browser* browser) {
- content::RecordAction(UserMetricsAction("Feedback"));
+ base::RecordAction(UserMetricsAction("Feedback"));
chrome::ShowFeedbackPage(browser, std::string(), std::string());
}
void ToggleBookmarkBar(Browser* browser) {
- content::RecordAction(UserMetricsAction("ShowBookmarksBar"));
+ base::RecordAction(UserMetricsAction("ShowBookmarksBar"));
ToggleBookmarkBarWhenVisible(browser->profile());
}
@@ -1141,7 +1141,7 @@ void OpenUpdateChromeDialog(Browser* browser) {
content::NotificationService::AllSources(),
content::NotificationService::NoDetails());
} else {
- content::RecordAction(UserMetricsAction("UpdateChrome"));
+ base::RecordAction(UserMetricsAction("UpdateChrome"));
browser->window()->ShowUpdateChromeDialog();
}
}
@@ -1223,7 +1223,7 @@ void ViewSource(Browser* browser,
WebContents* contents,
const GURL& url,
const content::PageState& page_state) {
- content::RecordAction(UserMetricsAction("ViewSource"));
+ base::RecordAction(UserMetricsAction("ViewSource"));
DCHECK(contents);
WebContents* view_source_contents = contents->Clone();
@@ -1295,14 +1295,14 @@ bool CanViewSource(const Browser* browser) {
#if BUILDFLAG(ENABLE_EXTENSIONS)
void CreateApplicationShortcuts(Browser* browser) {
- content::RecordAction(UserMetricsAction("CreateShortcut"));
+ base::RecordAction(UserMetricsAction("CreateShortcut"));
extensions::TabHelper::FromWebContents(
browser->tab_strip_model()->GetActiveWebContents())->
CreateApplicationShortcuts();
}
void CreateBookmarkAppFromCurrentWebContents(Browser* browser) {
- content::RecordAction(UserMetricsAction("CreateHostedApp"));
+ base::RecordAction(UserMetricsAction("CreateHostedApp"));
extensions::TabHelper::FromWebContents(
browser->tab_strip_model()->GetActiveWebContents())->
CreateHostedAppFromWebContents();
« no previous file with comments | « chrome/browser/ui/browser_command_controller.cc ('k') | chrome/browser/ui/browser_commands_chromeos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698