| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #if defined(TOOLKIT_USES_GTK) | 7 #if defined(TOOLKIT_USES_GTK) |
| 8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
| 9 #endif | 9 #endif |
| 10 | 10 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 #include "chrome/common/chrome_notification_types.h" | 73 #include "chrome/common/chrome_notification_types.h" |
| 74 #include "chrome/common/chrome_switches.h" | 74 #include "chrome/common/chrome_switches.h" |
| 75 #include "chrome/common/extensions/extension_resource.h" | 75 #include "chrome/common/extensions/extension_resource.h" |
| 76 #include "chrome/common/pref_names.h" | 76 #include "chrome/common/pref_names.h" |
| 77 #include "chrome/common/url_constants.h" | 77 #include "chrome/common/url_constants.h" |
| 78 #include "content/browser/download/download_manager.h" | 78 #include "content/browser/download/download_manager.h" |
| 79 #include "content/browser/renderer_host/render_view_host.h" | 79 #include "content/browser/renderer_host/render_view_host.h" |
| 80 #include "content/browser/renderer_host/render_widget_host_view.h" | 80 #include "content/browser/renderer_host/render_widget_host_view.h" |
| 81 #include "content/browser/tab_contents/tab_contents.h" | 81 #include "content/browser/tab_contents/tab_contents.h" |
| 82 #include "content/browser/tab_contents/tab_contents_view.h" | 82 #include "content/browser/tab_contents/tab_contents_view.h" |
| 83 #include "content/browser/user_metrics.h" | |
| 84 #include "content/public/browser/notification_service.h" | 83 #include "content/public/browser/notification_service.h" |
| 84 #include "content/public/browser/user_metrics.h" |
| 85 #include "content/public/common/content_switches.h" | 85 #include "content/public/common/content_switches.h" |
| 86 #include "grit/chromium_strings.h" | 86 #include "grit/chromium_strings.h" |
| 87 #include "grit/generated_resources.h" | 87 #include "grit/generated_resources.h" |
| 88 #include "grit/locale_settings.h" | 88 #include "grit/locale_settings.h" |
| 89 #include "grit/theme_resources.h" | 89 #include "grit/theme_resources.h" |
| 90 #include "grit/theme_resources_standard.h" | 90 #include "grit/theme_resources_standard.h" |
| 91 #include "grit/ui_resources.h" | 91 #include "grit/ui_resources.h" |
| 92 #include "grit/webkit_resources.h" | 92 #include "grit/webkit_resources.h" |
| 93 #include "ui/base/accelerators/accelerator.h" | 93 #include "ui/base/accelerators/accelerator.h" |
| 94 #include "ui/base/accessibility/accessible_view_state.h" | 94 #include "ui/base/accessibility/accessible_view_state.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 | 133 |
| 134 #if !defined(OS_CHROMEOS) || defined(USE_AURA) | 134 #if !defined(OS_CHROMEOS) || defined(USE_AURA) |
| 135 #include "chrome/browser/ui/views/download/download_shelf_view.h" | 135 #include "chrome/browser/ui/views/download/download_shelf_view.h" |
| 136 #endif | 136 #endif |
| 137 | 137 |
| 138 #if defined(USE_VIRTUAL_KEYBOARD) | 138 #if defined(USE_VIRTUAL_KEYBOARD) |
| 139 #include "chrome/browser/ui/touch/status_bubble_touch.h" | 139 #include "chrome/browser/ui/touch/status_bubble_touch.h" |
| 140 #endif | 140 #endif |
| 141 | 141 |
| 142 using base::TimeDelta; | 142 using base::TimeDelta; |
| 143 using content::UserMetricsAction; |
| 143 using views::ColumnSet; | 144 using views::ColumnSet; |
| 144 using views::GridLayout; | 145 using views::GridLayout; |
| 145 | 146 |
| 146 namespace { | 147 namespace { |
| 147 // The height of the status bubble. | 148 // The height of the status bubble. |
| 148 const int kStatusBubbleHeight = 20; | 149 const int kStatusBubbleHeight = 20; |
| 149 // The name of a key to store on the window handle so that other code can | 150 // The name of a key to store on the window handle so that other code can |
| 150 // locate this object using just the handle. | 151 // locate this object using just the handle. |
| 151 const char* const kBrowserViewKey = "__BROWSER_VIEW__"; | 152 const char* const kBrowserViewKey = "__BROWSER_VIEW__"; |
| 152 // How frequently we check for hung plugin windows. | 153 // How frequently we check for hung plugin windows. |
| (...skipping 2350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2503 pref_service->SetInteger(prefs::kHungPluginDetectFrequency, | 2504 pref_service->SetInteger(prefs::kHungPluginDetectFrequency, |
| 2504 hung_plugin_detect_freq); | 2505 hung_plugin_detect_freq); |
| 2505 } | 2506 } |
| 2506 #endif | 2507 #endif |
| 2507 } | 2508 } |
| 2508 | 2509 |
| 2509 void BrowserView::UpdateAcceleratorMetrics( | 2510 void BrowserView::UpdateAcceleratorMetrics( |
| 2510 const ui::Accelerator& accelerator, int command_id) { | 2511 const ui::Accelerator& accelerator, int command_id) { |
| 2511 const ui::KeyboardCode key_code = accelerator.key_code(); | 2512 const ui::KeyboardCode key_code = accelerator.key_code(); |
| 2512 if (command_id == IDC_HELP_PAGE && key_code == ui::VKEY_F1) | 2513 if (command_id == IDC_HELP_PAGE && key_code == ui::VKEY_F1) |
| 2513 UserMetrics::RecordAction(UserMetricsAction("ShowHelpTabViaF1")); | 2514 content::RecordAction(UserMetricsAction("ShowHelpTabViaF1")); |
| 2514 | 2515 |
| 2515 #if defined(OS_CHROMEOS) | 2516 #if defined(OS_CHROMEOS) |
| 2516 // Collect information about the relative popularity of various accelerators | 2517 // Collect information about the relative popularity of various accelerators |
| 2517 // on Chrome OS. | 2518 // on Chrome OS. |
| 2518 switch (command_id) { | 2519 switch (command_id) { |
| 2519 case IDC_BACK: | 2520 case IDC_BACK: |
| 2520 if (key_code == ui::VKEY_BACK) | 2521 if (key_code == ui::VKEY_BACK) |
| 2521 UserMetrics::RecordAction(UserMetricsAction("Accel_Back_Backspace")); | 2522 content::RecordAction(UserMetricsAction("Accel_Back_Backspace")); |
| 2522 else if (key_code == ui::VKEY_F1) | 2523 else if (key_code == ui::VKEY_F1) |
| 2523 UserMetrics::RecordAction(UserMetricsAction("Accel_Back_F1")); | 2524 content::RecordAction(UserMetricsAction("Accel_Back_F1")); |
| 2524 else if (key_code == ui::VKEY_LEFT) | 2525 else if (key_code == ui::VKEY_LEFT) |
| 2525 UserMetrics::RecordAction(UserMetricsAction("Accel_Back_Left")); | 2526 content::RecordAction(UserMetricsAction("Accel_Back_Left")); |
| 2526 break; | 2527 break; |
| 2527 case IDC_FORWARD: | 2528 case IDC_FORWARD: |
| 2528 if (key_code == ui::VKEY_BACK) | 2529 if (key_code == ui::VKEY_BACK) |
| 2529 UserMetrics::RecordAction(UserMetricsAction("Accel_Forward_Backspace")); | 2530 content::RecordAction(UserMetricsAction("Accel_Forward_Backspace")); |
| 2530 else if (key_code == ui::VKEY_F2) | 2531 else if (key_code == ui::VKEY_F2) |
| 2531 UserMetrics::RecordAction(UserMetricsAction("Accel_Forward_F2")); | 2532 content::RecordAction(UserMetricsAction("Accel_Forward_F2")); |
| 2532 else if (key_code == ui::VKEY_RIGHT) | 2533 else if (key_code == ui::VKEY_RIGHT) |
| 2533 UserMetrics::RecordAction(UserMetricsAction("Accel_Forward_Right")); | 2534 content::RecordAction(UserMetricsAction("Accel_Forward_Right")); |
| 2534 break; | 2535 break; |
| 2535 case IDC_RELOAD: | 2536 case IDC_RELOAD: |
| 2536 case IDC_RELOAD_IGNORING_CACHE: | 2537 case IDC_RELOAD_IGNORING_CACHE: |
| 2537 if (key_code == ui::VKEY_R) | 2538 if (key_code == ui::VKEY_R) |
| 2538 UserMetrics::RecordAction(UserMetricsAction("Accel_Reload_R")); | 2539 content::RecordAction(UserMetricsAction("Accel_Reload_R")); |
| 2539 else if (key_code == ui::VKEY_F3) | 2540 else if (key_code == ui::VKEY_F3) |
| 2540 UserMetrics::RecordAction(UserMetricsAction("Accel_Reload_F3")); | 2541 content::RecordAction(UserMetricsAction("Accel_Reload_F3")); |
| 2541 break; | 2542 break; |
| 2542 case IDC_FULLSCREEN: | 2543 case IDC_FULLSCREEN: |
| 2543 if (key_code == ui::VKEY_F4) | 2544 if (key_code == ui::VKEY_F4) |
| 2544 UserMetrics::RecordAction(UserMetricsAction("Accel_Fullscreen_F4")); | 2545 content::RecordAction(UserMetricsAction("Accel_Fullscreen_F4")); |
| 2545 break; | 2546 break; |
| 2546 case IDC_NEW_TAB: | 2547 case IDC_NEW_TAB: |
| 2547 if (key_code == ui::VKEY_T) | 2548 if (key_code == ui::VKEY_T) |
| 2548 UserMetrics::RecordAction(UserMetricsAction("Accel_NewTab_T")); | 2549 content::RecordAction(UserMetricsAction("Accel_NewTab_T")); |
| 2549 break; | 2550 break; |
| 2550 case IDC_SEARCH: | 2551 case IDC_SEARCH: |
| 2551 if (key_code == ui::VKEY_LWIN) | 2552 if (key_code == ui::VKEY_LWIN) |
| 2552 UserMetrics::RecordAction(UserMetricsAction("Accel_Search_LWin")); | 2553 content::RecordAction(UserMetricsAction("Accel_Search_LWin")); |
| 2553 break; | 2554 break; |
| 2554 case IDC_FOCUS_LOCATION: | 2555 case IDC_FOCUS_LOCATION: |
| 2555 if (key_code == ui::VKEY_D) | 2556 if (key_code == ui::VKEY_D) |
| 2556 UserMetrics::RecordAction(UserMetricsAction("Accel_FocusLocation_D")); | 2557 content::RecordAction(UserMetricsAction("Accel_FocusLocation_D")); |
| 2557 else if (key_code == ui::VKEY_L) | 2558 else if (key_code == ui::VKEY_L) |
| 2558 UserMetrics::RecordAction(UserMetricsAction("Accel_FocusLocation_L")); | 2559 content::RecordAction(UserMetricsAction("Accel_FocusLocation_L")); |
| 2559 break; | 2560 break; |
| 2560 case IDC_FOCUS_SEARCH: | 2561 case IDC_FOCUS_SEARCH: |
| 2561 if (key_code == ui::VKEY_E) | 2562 if (key_code == ui::VKEY_E) |
| 2562 UserMetrics::RecordAction(UserMetricsAction("Accel_FocusSearch_E")); | 2563 content::RecordAction(UserMetricsAction("Accel_FocusSearch_E")); |
| 2563 else if (key_code == ui::VKEY_K) | 2564 else if (key_code == ui::VKEY_K) |
| 2564 UserMetrics::RecordAction(UserMetricsAction("Accel_FocusSearch_K")); | 2565 content::RecordAction(UserMetricsAction("Accel_FocusSearch_K")); |
| 2565 break; | 2566 break; |
| 2566 default: | 2567 default: |
| 2567 // Do nothing. | 2568 // Do nothing. |
| 2568 break; | 2569 break; |
| 2569 } | 2570 } |
| 2570 #endif | 2571 #endif |
| 2571 } | 2572 } |
| 2572 | 2573 |
| 2573 void BrowserView::ProcessTabSelected(TabContentsWrapper* new_contents) { | 2574 void BrowserView::ProcessTabSelected(TabContentsWrapper* new_contents) { |
| 2574 // If |contents_container_| already has the correct TabContents, we can save | 2575 // If |contents_container_| already has the correct TabContents, we can save |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2657 browser::CreateViewsBubble(bubble); | 2658 browser::CreateViewsBubble(bubble); |
| 2658 bubble->SetAlignment(views::BubbleBorder::ALIGN_EDGE_TO_ANCHOR_EDGE); | 2659 bubble->SetAlignment(views::BubbleBorder::ALIGN_EDGE_TO_ANCHOR_EDGE); |
| 2659 bubble->Show(); | 2660 bubble->Show(); |
| 2660 } | 2661 } |
| 2661 | 2662 |
| 2662 void BrowserView::ShowAvatarBubbleFromAvatarButton() { | 2663 void BrowserView::ShowAvatarBubbleFromAvatarButton() { |
| 2663 AvatarMenuButton* button = frame_->GetAvatarMenuButton(); | 2664 AvatarMenuButton* button = frame_->GetAvatarMenuButton(); |
| 2664 if (button) | 2665 if (button) |
| 2665 button->ShowAvatarBubble(); | 2666 button->ShowAvatarBubble(); |
| 2666 } | 2667 } |
| OLD | NEW |