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" |
73 #include "net/base/escape.h" | 76 #include "net/base/escape.h" |
74 #include "webkit/glue/glue_serialize.h" | 77 #include "webkit/glue/glue_serialize.h" |
75 #include "webkit/glue/web_intent_data.h" | 78 #include "webkit/glue/web_intent_data.h" |
76 #include "webkit/user_agent/user_agent_util.h" | 79 #include "webkit/user_agent/user_agent_util.h" |
77 | 80 |
78 #if defined(OS_MACOSX) | 81 #if defined(OS_MACOSX) |
79 #include "ui/base/cocoa/find_pasteboard.h" | 82 #include "ui/base/cocoa/find_pasteboard.h" |
80 #endif | 83 #endif |
81 | 84 |
82 #if defined(OS_WIN) | 85 #if defined(OS_WIN) |
83 #include "chrome/browser/ui/metro_pin_tab_helper_win.h" | 86 #include "chrome/browser/ui/metro_pin_tab_helper_win.h" |
84 #include "win8/util/win8_util.h" | 87 #include "win8/util/win8_util.h" |
85 #endif | 88 #endif |
86 | 89 |
87 namespace { | 90 namespace { |
88 const char kOsOverrideForTabletSite[] = "Linux; Android 4.0.3"; | 91 const char kOsOverrideForTabletSite[] = "Linux; Android 4.0.3"; |
92 | |
Finnur
2013/01/30 15:50:48
nit: Space after but not before?
MAD
2013/01/31 21:31:42
Done.
| |
89 } | 93 } |
90 | 94 |
91 using content::NavigationController; | 95 using content::NavigationController; |
92 using content::NavigationEntry; | 96 using content::NavigationEntry; |
93 using content::OpenURLParams; | 97 using content::OpenURLParams; |
94 using content::Referrer; | 98 using content::Referrer; |
95 using content::SSLStatus; | 99 using content::SSLStatus; |
96 using content::UserMetricsAction; | 100 using content::UserMetricsAction; |
97 using content::WebContents; | 101 using content::WebContents; |
98 | 102 |
(...skipping 812 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
911 void ShowAppMenu(Browser* browser) { | 915 void ShowAppMenu(Browser* browser) { |
912 // We record the user metric for this event in WrenchMenu::RunMenu. | 916 // We record the user metric for this event in WrenchMenu::RunMenu. |
913 browser->window()->ShowAppMenu(); | 917 browser->window()->ShowAppMenu(); |
914 } | 918 } |
915 | 919 |
916 void ShowAvatarMenu(Browser* browser) { | 920 void ShowAvatarMenu(Browser* browser) { |
917 browser->window()->ShowAvatarBubbleFromAvatarButton(); | 921 browser->window()->ShowAvatarBubbleFromAvatarButton(); |
918 } | 922 } |
919 | 923 |
920 void OpenUpdateChromeDialog(Browser* browser) { | 924 void OpenUpdateChromeDialog(Browser* browser) { |
921 content::RecordAction(UserMetricsAction("UpdateChrome")); | 925 if (UpgradeDetector::GetInstance()->is_outdated_install()) { |
922 browser->window()->ShowUpdateChromeDialog(); | 926 content::NotificationService::current()->Notify( |
927 chrome::NOTIFICATION_OUTDATED_INSTALL, | |
928 content::NotificationService::AllSources(), | |
929 content::NotificationService::NoDetails()); | |
930 } else { | |
931 content::RecordAction(UserMetricsAction("UpdateChrome")); | |
932 browser->window()->ShowUpdateChromeDialog(); | |
933 } | |
923 } | 934 } |
924 | 935 |
925 void ToggleSpeechInput(Browser* browser) { | 936 void ToggleSpeechInput(Browser* browser) { |
926 browser->tab_strip_model()->GetActiveWebContents()-> | 937 browser->tab_strip_model()->GetActiveWebContents()-> |
927 GetRenderViewHost()->ToggleSpeechInput(); | 938 GetRenderViewHost()->ToggleSpeechInput(); |
928 } | 939 } |
929 | 940 |
930 bool CanRequestTabletSite(WebContents* current_tab) { | 941 bool CanRequestTabletSite(WebContents* current_tab) { |
931 if (!current_tab) | 942 if (!current_tab) |
932 return false; | 943 return false; |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1094 Browser::CreateParams::CreateForApp( | 1105 Browser::CreateParams::CreateForApp( |
1095 Browser::TYPE_POPUP, app_name, gfx::Rect(), browser->profile())); | 1106 Browser::TYPE_POPUP, app_name, gfx::Rect(), browser->profile())); |
1096 app_browser->tab_strip_model()->AppendWebContents(contents, true); | 1107 app_browser->tab_strip_model()->AppendWebContents(contents, true); |
1097 | 1108 |
1098 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; | 1109 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; |
1099 contents->GetRenderViewHost()->SyncRendererPrefs(); | 1110 contents->GetRenderViewHost()->SyncRendererPrefs(); |
1100 app_browser->window()->Show(); | 1111 app_browser->window()->Show(); |
1101 } | 1112 } |
1102 | 1113 |
1103 } // namespace chrome | 1114 } // namespace chrome |
OLD | NEW |