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

Side by Side Diff: chrome/browser/ui/views/frame/browser_view.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 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/views/frame/browser_view.h" 5 #include "chrome/browser/ui/views/frame/browser_view.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <memory> 10 #include <memory>
11 #include <utility> 11 #include <utility>
12 12
13 #include "base/auto_reset.h" 13 #include "base/auto_reset.h"
14 #include "base/command_line.h" 14 #include "base/command_line.h"
15 #include "base/i18n/rtl.h" 15 #include "base/i18n/rtl.h"
16 #include "base/location.h" 16 #include "base/location.h"
17 #include "base/macros.h" 17 #include "base/macros.h"
18 #include "base/metrics/histogram_macros.h" 18 #include "base/metrics/histogram_macros.h"
19 #include "base/metrics/user_metrics.h"
19 #include "base/profiler/scoped_tracker.h" 20 #include "base/profiler/scoped_tracker.h"
20 #include "base/single_thread_task_runner.h" 21 #include "base/single_thread_task_runner.h"
21 #include "base/strings/string_number_conversions.h" 22 #include "base/strings/string_number_conversions.h"
22 #include "base/threading/thread_task_runner_handle.h" 23 #include "base/threading/thread_task_runner_handle.h"
23 #include "build/build_config.h" 24 #include "build/build_config.h"
24 #include "chrome/app/chrome_command_ids.h" 25 #include "chrome/app/chrome_command_ids.h"
25 #include "chrome/browser/app_mode/app_mode_utils.h" 26 #include "chrome/browser/app_mode/app_mode_utils.h"
26 #include "chrome/browser/bookmarks/bookmark_stats.h" 27 #include "chrome/browser/bookmarks/bookmark_stats.h"
27 #include "chrome/browser/browser_process.h" 28 #include "chrome/browser/browser_process.h"
28 #include "chrome/browser/chrome_notification_types.h" 29 #include "chrome/browser/chrome_notification_types.h"
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 #include "components/prefs/pref_service.h" 112 #include "components/prefs/pref_service.h"
112 #include "components/sessions/core/tab_restore_service.h" 113 #include "components/sessions/core/tab_restore_service.h"
113 #include "components/signin/core/common/profile_management_switches.h" 114 #include "components/signin/core/common/profile_management_switches.h"
114 #include "components/translate/core/browser/language_state.h" 115 #include "components/translate/core/browser/language_state.h"
115 #include "content/public/browser/download_manager.h" 116 #include "content/public/browser/download_manager.h"
116 #include "content/public/browser/keyboard_event_processing_result.h" 117 #include "content/public/browser/keyboard_event_processing_result.h"
117 #include "content/public/browser/notification_service.h" 118 #include "content/public/browser/notification_service.h"
118 #include "content/public/browser/render_frame_host.h" 119 #include "content/public/browser/render_frame_host.h"
119 #include "content/public/browser/render_view_host.h" 120 #include "content/public/browser/render_view_host.h"
120 #include "content/public/browser/render_widget_host_view.h" 121 #include "content/public/browser/render_widget_host_view.h"
121 #include "content/public/browser/user_metrics.h"
122 #include "content/public/browser/web_contents.h" 122 #include "content/public/browser/web_contents.h"
123 #include "content/public/common/content_switches.h" 123 #include "content/public/common/content_switches.h"
124 #include "ui/accessibility/ax_node_data.h" 124 #include "ui/accessibility/ax_node_data.h"
125 #include "ui/base/accelerators/accelerator.h" 125 #include "ui/base/accelerators/accelerator.h"
126 #include "ui/base/hit_test.h" 126 #include "ui/base/hit_test.h"
127 #include "ui/base/l10n/l10n_util.h" 127 #include "ui/base/l10n/l10n_util.h"
128 #include "ui/base/resource/resource_bundle.h" 128 #include "ui/base/resource/resource_bundle.h"
129 #include "ui/base/theme_provider.h" 129 #include "ui/base/theme_provider.h"
130 #include "ui/content_accelerators/accelerator_util.h" 130 #include "ui/content_accelerators/accelerator_util.h"
131 #include "ui/display/screen.h" 131 #include "ui/display/screen.h"
(...skipping 2324 matching lines...) Expand 10 before | Expand all | Expand 10 after
2456 #else 2456 #else
2457 // App commands are Windows-specific so there's nothing to do here. 2457 // App commands are Windows-specific so there's nothing to do here.
2458 return -1; 2458 return -1;
2459 #endif 2459 #endif
2460 } 2460 }
2461 2461
2462 void BrowserView::UpdateAcceleratorMetrics(const ui::Accelerator& accelerator, 2462 void BrowserView::UpdateAcceleratorMetrics(const ui::Accelerator& accelerator,
2463 int command_id) { 2463 int command_id) {
2464 const ui::KeyboardCode key_code = accelerator.key_code(); 2464 const ui::KeyboardCode key_code = accelerator.key_code();
2465 if (command_id == IDC_HELP_PAGE_VIA_KEYBOARD && key_code == ui::VKEY_F1) 2465 if (command_id == IDC_HELP_PAGE_VIA_KEYBOARD && key_code == ui::VKEY_F1)
2466 content::RecordAction(UserMetricsAction("ShowHelpTabViaF1")); 2466 base::RecordAction(UserMetricsAction("ShowHelpTabViaF1"));
2467 2467
2468 if (command_id == IDC_BOOKMARK_PAGE) 2468 if (command_id == IDC_BOOKMARK_PAGE)
2469 UMA_HISTOGRAM_ENUMERATION("Bookmarks.EntryPoint", 2469 UMA_HISTOGRAM_ENUMERATION("Bookmarks.EntryPoint",
2470 BOOKMARK_ENTRY_POINT_ACCELERATOR, 2470 BOOKMARK_ENTRY_POINT_ACCELERATOR,
2471 BOOKMARK_ENTRY_POINT_LIMIT); 2471 BOOKMARK_ENTRY_POINT_LIMIT);
2472 2472
2473 #if defined(OS_CHROMEOS) 2473 #if defined(OS_CHROMEOS)
2474 // Collect information about the relative popularity of various accelerators 2474 // Collect information about the relative popularity of various accelerators
2475 // on Chrome OS. 2475 // on Chrome OS.
2476 switch (command_id) { 2476 switch (command_id) {
2477 case IDC_BACK: 2477 case IDC_BACK:
2478 if (key_code == ui::VKEY_BROWSER_BACK) 2478 if (key_code == ui::VKEY_BROWSER_BACK)
2479 content::RecordAction(UserMetricsAction("Accel_Back_F1")); 2479 base::RecordAction(UserMetricsAction("Accel_Back_F1"));
2480 else if (key_code == ui::VKEY_LEFT) 2480 else if (key_code == ui::VKEY_LEFT)
2481 content::RecordAction(UserMetricsAction("Accel_Back_Left")); 2481 base::RecordAction(UserMetricsAction("Accel_Back_Left"));
2482 break; 2482 break;
2483 case IDC_FORWARD: 2483 case IDC_FORWARD:
2484 if (key_code == ui::VKEY_BROWSER_FORWARD) 2484 if (key_code == ui::VKEY_BROWSER_FORWARD)
2485 content::RecordAction(UserMetricsAction("Accel_Forward_F2")); 2485 base::RecordAction(UserMetricsAction("Accel_Forward_F2"));
2486 else if (key_code == ui::VKEY_RIGHT) 2486 else if (key_code == ui::VKEY_RIGHT)
2487 content::RecordAction(UserMetricsAction("Accel_Forward_Right")); 2487 base::RecordAction(UserMetricsAction("Accel_Forward_Right"));
2488 break; 2488 break;
2489 case IDC_RELOAD: 2489 case IDC_RELOAD:
2490 case IDC_RELOAD_BYPASSING_CACHE: 2490 case IDC_RELOAD_BYPASSING_CACHE:
2491 if (key_code == ui::VKEY_R) 2491 if (key_code == ui::VKEY_R)
2492 content::RecordAction(UserMetricsAction("Accel_Reload_R")); 2492 base::RecordAction(UserMetricsAction("Accel_Reload_R"));
2493 else if (key_code == ui::VKEY_BROWSER_REFRESH) 2493 else if (key_code == ui::VKEY_BROWSER_REFRESH)
2494 content::RecordAction(UserMetricsAction("Accel_Reload_F3")); 2494 base::RecordAction(UserMetricsAction("Accel_Reload_F3"));
2495 break; 2495 break;
2496 case IDC_FOCUS_LOCATION: 2496 case IDC_FOCUS_LOCATION:
2497 if (key_code == ui::VKEY_D) 2497 if (key_code == ui::VKEY_D)
2498 content::RecordAction(UserMetricsAction("Accel_FocusLocation_D")); 2498 base::RecordAction(UserMetricsAction("Accel_FocusLocation_D"));
2499 else if (key_code == ui::VKEY_L) 2499 else if (key_code == ui::VKEY_L)
2500 content::RecordAction(UserMetricsAction("Accel_FocusLocation_L")); 2500 base::RecordAction(UserMetricsAction("Accel_FocusLocation_L"));
2501 break; 2501 break;
2502 case IDC_FOCUS_SEARCH: 2502 case IDC_FOCUS_SEARCH:
2503 if (key_code == ui::VKEY_E) 2503 if (key_code == ui::VKEY_E)
2504 content::RecordAction(UserMetricsAction("Accel_FocusSearch_E")); 2504 base::RecordAction(UserMetricsAction("Accel_FocusSearch_E"));
2505 else if (key_code == ui::VKEY_K) 2505 else if (key_code == ui::VKEY_K)
2506 content::RecordAction(UserMetricsAction("Accel_FocusSearch_K")); 2506 base::RecordAction(UserMetricsAction("Accel_FocusSearch_K"));
2507 break; 2507 break;
2508 default: 2508 default:
2509 // Do nothing. 2509 // Do nothing.
2510 break; 2510 break;
2511 } 2511 }
2512 #endif 2512 #endif
2513 } 2513 }
2514 2514
2515 void BrowserView::ShowAvatarBubbleFromAvatarButton( 2515 void BrowserView::ShowAvatarBubbleFromAvatarButton(
2516 AvatarBubbleMode mode, 2516 AvatarBubbleMode mode,
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
2684 } 2684 }
2685 2685
2686 extensions::ActiveTabPermissionGranter* 2686 extensions::ActiveTabPermissionGranter*
2687 BrowserView::GetActiveTabPermissionGranter() { 2687 BrowserView::GetActiveTabPermissionGranter() {
2688 content::WebContents* web_contents = GetActiveWebContents(); 2688 content::WebContents* web_contents = GetActiveWebContents();
2689 if (!web_contents) 2689 if (!web_contents)
2690 return nullptr; 2690 return nullptr;
2691 return extensions::TabHelper::FromWebContents(web_contents) 2691 return extensions::TabHelper::FromWebContents(web_contents)
2692 ->active_tab_permission_granter(); 2692 ->active_tab_permission_granter();
2693 } 2693 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698