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/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/browser/bookmarks/bookmark_model.h" | 10 #include "chrome/browser/bookmarks/bookmark_model.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/browser/web_intents_dispatcher.h" | 71 #include "content/public/browser/web_intents_dispatcher.h" |
69 #include "content/public/common/content_client.h" | 72 #include "content/public/common/content_client.h" |
70 #include "content/public/common/content_restriction.h" | 73 #include "content/public/common/content_restriction.h" |
71 #include "content/public/common/renderer_preferences.h" | 74 #include "content/public/common/renderer_preferences.h" |
72 #include "content/public/common/url_constants.h" | 75 #include "content/public/common/url_constants.h" |
(...skipping 838 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
911 void ShowAppMenu(Browser* browser) { | 914 void ShowAppMenu(Browser* browser) { |
912 // We record the user metric for this event in WrenchMenu::RunMenu. | 915 // We record the user metric for this event in WrenchMenu::RunMenu. |
913 browser->window()->ShowAppMenu(); | 916 browser->window()->ShowAppMenu(); |
914 } | 917 } |
915 | 918 |
916 void ShowAvatarMenu(Browser* browser) { | 919 void ShowAvatarMenu(Browser* browser) { |
917 browser->window()->ShowAvatarBubbleFromAvatarButton(); | 920 browser->window()->ShowAvatarBubbleFromAvatarButton(); |
918 } | 921 } |
919 | 922 |
920 void OpenUpdateChromeDialog(Browser* browser) { | 923 void OpenUpdateChromeDialog(Browser* browser) { |
921 content::RecordAction(UserMetricsAction("UpdateChrome")); | 924 if (UpgradeDetector::GetInstance()->is_outdated_install()) { |
922 browser->window()->ShowUpdateChromeDialog(); | 925 content::NotificationService::current()->Notify( |
| 926 chrome::NOTIFICATION_OUTDATED_INSTALL, |
| 927 content::NotificationService::AllSources(), |
| 928 content::NotificationService::NoDetails()); |
| 929 } else { |
| 930 content::RecordAction(UserMetricsAction("UpdateChrome")); |
| 931 browser->window()->ShowUpdateChromeDialog(); |
| 932 } |
923 } | 933 } |
924 | 934 |
925 void ToggleSpeechInput(Browser* browser) { | 935 void ToggleSpeechInput(Browser* browser) { |
926 browser->tab_strip_model()->GetActiveWebContents()-> | 936 browser->tab_strip_model()->GetActiveWebContents()-> |
927 GetRenderViewHost()->ToggleSpeechInput(); | 937 GetRenderViewHost()->ToggleSpeechInput(); |
928 } | 938 } |
929 | 939 |
930 bool CanRequestTabletSite(WebContents* current_tab) { | 940 bool CanRequestTabletSite(WebContents* current_tab) { |
931 if (!current_tab) | 941 if (!current_tab) |
932 return false; | 942 return false; |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1094 Browser::CreateParams::CreateForApp( | 1104 Browser::CreateParams::CreateForApp( |
1095 Browser::TYPE_POPUP, app_name, gfx::Rect(), browser->profile())); | 1105 Browser::TYPE_POPUP, app_name, gfx::Rect(), browser->profile())); |
1096 app_browser->tab_strip_model()->AppendWebContents(contents, true); | 1106 app_browser->tab_strip_model()->AppendWebContents(contents, true); |
1097 | 1107 |
1098 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; | 1108 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; |
1099 contents->GetRenderViewHost()->SyncRendererPrefs(); | 1109 contents->GetRenderViewHost()->SyncRendererPrefs(); |
1100 app_browser->window()->Show(); | 1110 app_browser->window()->Show(); |
1101 } | 1111 } |
1102 | 1112 |
1103 } // namespace chrome | 1113 } // namespace chrome |
OLD | NEW |