OLD | NEW |
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.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 #include "chrome/browser/ui/find_bar/find_bar_controller.h" | 47 #include "chrome/browser/ui/find_bar/find_bar_controller.h" |
48 #include "chrome/browser/ui/find_bar/find_tab_helper.h" | 48 #include "chrome/browser/ui/find_bar/find_tab_helper.h" |
49 #include "chrome/browser/ui/fullscreen/fullscreen_controller.h" | 49 #include "chrome/browser/ui/fullscreen/fullscreen_controller.h" |
50 #include "chrome/browser/ui/omnibox/location_bar.h" | 50 #include "chrome/browser/ui/omnibox/location_bar.h" |
51 #include "chrome/browser/ui/search/search.h" | 51 #include "chrome/browser/ui/search/search.h" |
52 #include "chrome/browser/ui/search/search_model.h" | 52 #include "chrome/browser/ui/search/search_model.h" |
53 #include "chrome/browser/ui/status_bubble.h" | 53 #include "chrome/browser/ui/status_bubble.h" |
54 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 54 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
55 #include "chrome/browser/ui/web_contents_modal_dialog_manager.h" | 55 #include "chrome/browser/ui/web_contents_modal_dialog_manager.h" |
56 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h" | 56 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h" |
| 57 #include "chrome/browser/upgrade_detector.h" |
57 #include "chrome/browser/web_applications/web_app.h" | 58 #include "chrome/browser/web_applications/web_app.h" |
| 59 #include "chrome/common/chrome_notification_types.h" |
58 #include "chrome/common/chrome_switches.h" | 60 #include "chrome/common/chrome_switches.h" |
59 #include "chrome/common/pref_names.h" | 61 #include "chrome/common/pref_names.h" |
60 #include "content/public/browser/devtools_agent_host.h" | 62 #include "content/public/browser/devtools_agent_host.h" |
61 #include "content/public/browser/navigation_controller.h" | 63 #include "content/public/browser/navigation_controller.h" |
62 #include "content/public/browser/navigation_entry.h" | 64 #include "content/public/browser/navigation_entry.h" |
| 65 #include "content/public/browser/notification_service.h" |
63 #include "content/public/browser/page_navigator.h" | 66 #include "content/public/browser/page_navigator.h" |
64 #include "content/public/browser/render_view_host.h" | 67 #include "content/public/browser/render_view_host.h" |
65 #include "content/public/browser/user_metrics.h" | 68 #include "content/public/browser/user_metrics.h" |
66 #include "content/public/browser/web_contents.h" | 69 #include "content/public/browser/web_contents.h" |
67 #include "content/public/browser/web_contents_view.h" | 70 #include "content/public/browser/web_contents_view.h" |
68 #include "content/public/common/content_client.h" | 71 #include "content/public/common/content_client.h" |
69 #include "content/public/common/content_restriction.h" | 72 #include "content/public/common/content_restriction.h" |
70 #include "content/public/common/renderer_preferences.h" | 73 #include "content/public/common/renderer_preferences.h" |
71 #include "content/public/common/url_constants.h" | 74 #include "content/public/common/url_constants.h" |
72 #include "net/base/escape.h" | 75 #include "net/base/escape.h" |
(...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
909 void ShowAppMenu(Browser* browser) { | 912 void ShowAppMenu(Browser* browser) { |
910 // We record the user metric for this event in WrenchMenu::RunMenu. | 913 // We record the user metric for this event in WrenchMenu::RunMenu. |
911 browser->window()->ShowAppMenu(); | 914 browser->window()->ShowAppMenu(); |
912 } | 915 } |
913 | 916 |
914 void ShowAvatarMenu(Browser* browser) { | 917 void ShowAvatarMenu(Browser* browser) { |
915 browser->window()->ShowAvatarBubbleFromAvatarButton(); | 918 browser->window()->ShowAvatarBubbleFromAvatarButton(); |
916 } | 919 } |
917 | 920 |
918 void OpenUpdateChromeDialog(Browser* browser) { | 921 void OpenUpdateChromeDialog(Browser* browser) { |
919 content::RecordAction(UserMetricsAction("UpdateChrome")); | 922 if (UpgradeDetector::GetInstance()->is_outdated_install()) { |
920 browser->window()->ShowUpdateChromeDialog(); | 923 content::NotificationService::current()->Notify( |
| 924 chrome::NOTIFICATION_OUTDATED_INSTALL, |
| 925 content::NotificationService::AllSources(), |
| 926 content::NotificationService::NoDetails()); |
| 927 } else { |
| 928 content::RecordAction(UserMetricsAction("UpdateChrome")); |
| 929 browser->window()->ShowUpdateChromeDialog(); |
| 930 } |
921 } | 931 } |
922 | 932 |
923 void ToggleSpeechInput(Browser* browser) { | 933 void ToggleSpeechInput(Browser* browser) { |
924 browser->tab_strip_model()->GetActiveWebContents()-> | 934 browser->tab_strip_model()->GetActiveWebContents()-> |
925 GetRenderViewHost()->ToggleSpeechInput(); | 935 GetRenderViewHost()->ToggleSpeechInput(); |
926 } | 936 } |
927 | 937 |
928 bool CanRequestTabletSite(WebContents* current_tab) { | 938 bool CanRequestTabletSite(WebContents* current_tab) { |
929 if (!current_tab) | 939 if (!current_tab) |
930 return false; | 940 return false; |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1092 Browser::CreateParams::CreateForApp( | 1102 Browser::CreateParams::CreateForApp( |
1093 Browser::TYPE_POPUP, app_name, gfx::Rect(), browser->profile())); | 1103 Browser::TYPE_POPUP, app_name, gfx::Rect(), browser->profile())); |
1094 app_browser->tab_strip_model()->AppendWebContents(contents, true); | 1104 app_browser->tab_strip_model()->AppendWebContents(contents, true); |
1095 | 1105 |
1096 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; | 1106 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; |
1097 contents->GetRenderViewHost()->SyncRendererPrefs(); | 1107 contents->GetRenderViewHost()->SyncRendererPrefs(); |
1098 app_browser->window()->Show(); | 1108 app_browser->window()->Show(); |
1099 } | 1109 } |
1100 | 1110 |
1101 } // namespace chrome | 1111 } // namespace chrome |
OLD | NEW |