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

Side by Side Diff: chrome/browser/ui/browser_commands.cc

Issue 2400503002: [Translate] Integrate TranslateEventProto UMA logging into TranslateManager. (Closed)
Patch Set: plumb through to TranslateBubbleUiEvent UMA metric Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/browser_commands.h" 5 #include "chrome/browser/ui/browser_commands.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/metrics/histogram_macros.h" 8 #include "base/metrics/histogram_macros.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 #include "chrome/browser/ui/find_bar/find_bar_controller.h" 44 #include "chrome/browser/ui/find_bar/find_bar_controller.h"
45 #include "chrome/browser/ui/find_bar/find_tab_helper.h" 45 #include "chrome/browser/ui/find_bar/find_tab_helper.h"
46 #include "chrome/browser/ui/location_bar/location_bar.h" 46 #include "chrome/browser/ui/location_bar/location_bar.h"
47 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller.h" 47 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller.h"
48 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" 48 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h"
49 #include "chrome/browser/ui/search/search_tab_helper.h" 49 #include "chrome/browser/ui/search/search_tab_helper.h"
50 #include "chrome/browser/ui/status_bubble.h" 50 #include "chrome/browser/ui/status_bubble.h"
51 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" 51 #include "chrome/browser/ui/tab_contents/core_tab_helper.h"
52 #include "chrome/browser/ui/tab_dialogs.h" 52 #include "chrome/browser/ui/tab_dialogs.h"
53 #include "chrome/browser/ui/tabs/tab_strip_model.h" 53 #include "chrome/browser/ui/tabs/tab_strip_model.h"
54 #include "chrome/browser/ui/translate/translate_bubble_view_state_transition.h"
54 #include "chrome/browser/upgrade_detector.h" 55 #include "chrome/browser/upgrade_detector.h"
55 #include "chrome/common/content_restriction.h" 56 #include "chrome/common/content_restriction.h"
56 #include "chrome/common/features.h" 57 #include "chrome/common/features.h"
57 #include "chrome/common/pref_names.h" 58 #include "chrome/common/pref_names.h"
58 #include "components/bookmarks/browser/bookmark_model.h" 59 #include "components/bookmarks/browser/bookmark_model.h"
59 #include "components/bookmarks/browser/bookmark_utils.h" 60 #include "components/bookmarks/browser/bookmark_utils.h"
60 #include "components/bookmarks/common/bookmark_pref_names.h" 61 #include "components/bookmarks/common/bookmark_pref_names.h"
61 #include "components/favicon/content/content_favicon_driver.h" 62 #include "components/favicon/content/content_favicon_driver.h"
62 #include "components/google/core/browser/google_util.h" 63 #include "components/google/core/browser/google_util.h"
63 #include "components/prefs/pref_service.h" 64 #include "components/prefs/pref_service.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 111
111 #if defined(ENABLE_RLZ) 112 #if defined(ENABLE_RLZ)
112 #include "components/rlz/rlz_tracker.h" // nogncheck 113 #include "components/rlz/rlz_tracker.h" // nogncheck
113 #endif 114 #endif
114 115
115 #if defined(ENABLE_MEDIA_ROUTER) 116 #if defined(ENABLE_MEDIA_ROUTER)
116 #include "chrome/browser/media/router/media_router_dialog_controller.h" // nogn check 117 #include "chrome/browser/media/router/media_router_dialog_controller.h" // nogn check
117 #endif 118 #endif
118 119
119 namespace { 120 namespace {
121
120 const char kOsOverrideForTabletSite[] = "Linux; Android 4.0.3"; 122 const char kOsOverrideForTabletSite[] = "Linux; Android 4.0.3";
123
124 translate::TranslateBubbleUiEvent TranslateBubbleResultToUiEvent(
125 ShowTranslateBubbleResult result) {
groby-ooo-7-16 2016/11/15 01:15:43 The same thing applies here - I don't know if the
Roger McFarlane (Chromium) 2016/11/16 05:51:31 Or maybe get rid of ShowTranslateBubbleResult and
126 switch (result) {
127 case ShowTranslateBubbleResult::SUCCESS:
128 return translate::TranslateBubbleUiEvent::BUBBLE_SHOWN;
129 case ShowTranslateBubbleResult::BROWSER_WINDOW_NOT_VALID:
130 return translate::TranslateBubbleUiEvent::
131 BUBBLE_NOT_SHOWN_WINDOW_NOT_VALID;
132 case ShowTranslateBubbleResult::BROWSER_WINDOW_MINIMIZED:
133 return translate::TranslateBubbleUiEvent::
134 BUBBLE_NOT_SHOWN_WINDOW_MINIMIZED;
135 case ShowTranslateBubbleResult::BROWSER_WINDOW_NOT_ACTIVE:
136 return translate::TranslateBubbleUiEvent::
137 BUBBLE_NOT_SHOWN_WINDOW_NOT_ACTIVE;
138 case ShowTranslateBubbleResult::WEB_CONTENTS_NOT_ACTIVE:
139 return translate::TranslateBubbleUiEvent::
140 BUBBLE_NOT_SHOWN_WEB_CONTENTS_NOT_ACTIVE;
141 case ShowTranslateBubbleResult::EDITABLE_FIELD_IS_ACTIVE:
142 return translate::TranslateBubbleUiEvent::
143 BUBBLE_NOT_SHOWN_EDITABLE_FIELD_IS_ACTIVE;
144 }
121 } 145 }
122 146
147 } // namespace
148
123 using base::UserMetricsAction; 149 using base::UserMetricsAction;
124 using bookmarks::BookmarkModel; 150 using bookmarks::BookmarkModel;
125 using content::NavigationController; 151 using content::NavigationController;
126 using content::NavigationEntry; 152 using content::NavigationEntry;
127 using content::OpenURLParams; 153 using content::OpenURLParams;
128 using content::Referrer; 154 using content::Referrer;
129 using content::WebContents; 155 using content::WebContents;
130 156
131 namespace chrome { 157 namespace chrome {
132 namespace { 158 namespace {
(...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after
820 ChromeTranslateClient* chrome_translate_client = 846 ChromeTranslateClient* chrome_translate_client =
821 ChromeTranslateClient::FromWebContents(web_contents); 847 ChromeTranslateClient::FromWebContents(web_contents);
822 848
823 translate::TranslateStep step = translate::TRANSLATE_STEP_BEFORE_TRANSLATE; 849 translate::TranslateStep step = translate::TRANSLATE_STEP_BEFORE_TRANSLATE;
824 if (chrome_translate_client) { 850 if (chrome_translate_client) {
825 if (chrome_translate_client->GetLanguageState().translation_pending()) 851 if (chrome_translate_client->GetLanguageState().translation_pending())
826 step = translate::TRANSLATE_STEP_TRANSLATING; 852 step = translate::TRANSLATE_STEP_TRANSLATING;
827 else if (chrome_translate_client->GetLanguageState().IsPageTranslated()) 853 else if (chrome_translate_client->GetLanguageState().IsPageTranslated())
828 step = translate::TRANSLATE_STEP_AFTER_TRANSLATE; 854 step = translate::TRANSLATE_STEP_AFTER_TRANSLATE;
829 } 855 }
830 browser->window()->ShowTranslateBubble( 856 ShowTranslateBubbleResult result = browser->window()->ShowTranslateBubble(
831 web_contents, step, translate::TranslateErrors::NONE, true); 857 web_contents, step, translate::TranslateErrors::NONE, true);
858 if (result != ShowTranslateBubbleResult::SUCCESS)
859 translate::ReportUiAction(TranslateBubbleResultToUiEvent(result));
832 } 860 }
833 861
834 void ManagePasswordsForPage(Browser* browser) { 862 void ManagePasswordsForPage(Browser* browser) {
835 WebContents* web_contents = 863 WebContents* web_contents =
836 browser->tab_strip_model()->GetActiveWebContents(); 864 browser->tab_strip_model()->GetActiveWebContents();
837 ManagePasswordsUIController* controller = 865 ManagePasswordsUIController* controller =
838 ManagePasswordsUIController::FromWebContents(web_contents); 866 ManagePasswordsUIController::FromWebContents(web_contents);
839 TabDialogs::FromWebContents(web_contents)->ShowManagePasswordsBubble( 867 TabDialogs::FromWebContents(web_contents)->ShowManagePasswordsBubble(
840 !controller->IsAutomaticallyOpeningBubble()); 868 !controller->IsAutomaticallyOpeningBubble());
841 } 869 }
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after
1298 app_name, true /* trusted_source */, gfx::Rect(), browser->profile())); 1326 app_name, true /* trusted_source */, gfx::Rect(), browser->profile()));
1299 app_browser->tab_strip_model()->AppendWebContents(contents, true); 1327 app_browser->tab_strip_model()->AppendWebContents(contents, true);
1300 1328
1301 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; 1329 contents->GetMutableRendererPrefs()->can_accept_load_drops = false;
1302 contents->GetRenderViewHost()->SyncRendererPrefs(); 1330 contents->GetRenderViewHost()->SyncRendererPrefs();
1303 app_browser->window()->Show(); 1331 app_browser->window()->Show();
1304 } 1332 }
1305 #endif // defined(ENABLE_EXTENSIONS) 1333 #endif // defined(ENABLE_EXTENSIONS)
1306 1334
1307 } // namespace chrome 1335 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698