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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 #include "chrome/browser/ui/find_bar/find_bar_controller.h" | 45 #include "chrome/browser/ui/find_bar/find_bar_controller.h" |
46 #include "chrome/browser/ui/find_bar/find_tab_helper.h" | 46 #include "chrome/browser/ui/find_bar/find_tab_helper.h" |
47 #include "chrome/browser/ui/fullscreen/fullscreen_controller.h" | 47 #include "chrome/browser/ui/fullscreen/fullscreen_controller.h" |
48 #include "chrome/browser/ui/omnibox/location_bar.h" | 48 #include "chrome/browser/ui/omnibox/location_bar.h" |
49 #include "chrome/browser/ui/search/search.h" | 49 #include "chrome/browser/ui/search/search.h" |
50 #include "chrome/browser/ui/search/search_model.h" | 50 #include "chrome/browser/ui/search/search_model.h" |
51 #include "chrome/browser/ui/status_bubble.h" | 51 #include "chrome/browser/ui/status_bubble.h" |
52 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 52 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
53 #include "chrome/browser/ui/web_contents_modal_dialog_manager.h" | 53 #include "chrome/browser/ui/web_contents_modal_dialog_manager.h" |
54 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h" | 54 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h" |
| 55 #include "chrome/browser/upgrade_detector.h" |
55 #include "chrome/browser/web_applications/web_app.h" | 56 #include "chrome/browser/web_applications/web_app.h" |
56 #include "chrome/common/chrome_switches.h" | 57 #include "chrome/common/chrome_switches.h" |
57 #include "chrome/common/pref_names.h" | 58 #include "chrome/common/pref_names.h" |
58 #include "content/public/browser/devtools_agent_host.h" | 59 #include "content/public/browser/devtools_agent_host.h" |
59 #include "content/public/browser/navigation_controller.h" | 60 #include "content/public/browser/navigation_controller.h" |
60 #include "content/public/browser/navigation_entry.h" | 61 #include "content/public/browser/navigation_entry.h" |
61 #include "content/public/browser/page_navigator.h" | 62 #include "content/public/browser/page_navigator.h" |
62 #include "content/public/browser/render_view_host.h" | 63 #include "content/public/browser/render_view_host.h" |
63 #include "content/public/browser/user_metrics.h" | 64 #include "content/public/browser/user_metrics.h" |
64 #include "content/public/browser/web_contents.h" | 65 #include "content/public/browser/web_contents.h" |
(...skipping 12 matching lines...) Expand all Loading... |
77 #include "ui/base/cocoa/find_pasteboard.h" | 78 #include "ui/base/cocoa/find_pasteboard.h" |
78 #endif | 79 #endif |
79 | 80 |
80 #if defined(OS_WIN) | 81 #if defined(OS_WIN) |
81 #include "chrome/browser/ui/metro_pin_tab_helper_win.h" | 82 #include "chrome/browser/ui/metro_pin_tab_helper_win.h" |
82 #include "win8/util/win8_util.h" | 83 #include "win8/util/win8_util.h" |
83 #endif | 84 #endif |
84 | 85 |
85 namespace { | 86 namespace { |
86 const char kOsOverrideForTabletSite[] = "Linux; Android 4.0.3"; | 87 const char kOsOverrideForTabletSite[] = "Linux; Android 4.0.3"; |
| 88 |
| 89 const char kDownloadChromeUrl[] = "https://www.google.com/chrome/?&brand=CHWL" |
| 90 "&utm_campaign=en&utm_source=en-et-na-us-chrome-bubble&utm_medium=et"; |
87 } | 91 } |
88 | 92 |
89 using content::NavigationController; | 93 using content::NavigationController; |
90 using content::NavigationEntry; | 94 using content::NavigationEntry; |
91 using content::OpenURLParams; | 95 using content::OpenURLParams; |
92 using content::Referrer; | 96 using content::Referrer; |
93 using content::SSLStatus; | 97 using content::SSLStatus; |
94 using content::UserMetricsAction; | 98 using content::UserMetricsAction; |
95 using content::WebContents; | 99 using content::WebContents; |
96 | 100 |
(...skipping 805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
902 void ShowAppMenu(Browser* browser) { | 906 void ShowAppMenu(Browser* browser) { |
903 // We record the user metric for this event in WrenchMenu::RunMenu. | 907 // We record the user metric for this event in WrenchMenu::RunMenu. |
904 browser->window()->ShowAppMenu(); | 908 browser->window()->ShowAppMenu(); |
905 } | 909 } |
906 | 910 |
907 void ShowAvatarMenu(Browser* browser) { | 911 void ShowAvatarMenu(Browser* browser) { |
908 browser->window()->ShowAvatarBubbleFromAvatarButton(); | 912 browser->window()->ShowAvatarBubbleFromAvatarButton(); |
909 } | 913 } |
910 | 914 |
911 void OpenUpdateChromeDialog(Browser* browser) { | 915 void OpenUpdateChromeDialog(Browser* browser) { |
912 content::RecordAction(UserMetricsAction("UpdateChrome")); | 916 if (UpgradeDetector::GetInstance()->is_outdated_install()) { |
913 browser->window()->ShowUpdateChromeDialog(); | 917 content::RecordAction( |
| 918 content::UserMetricsAction("OutdatedUpgradeReinstall")); |
| 919 AddSelectedTabWithURL( |
| 920 browser, GURL(kDownloadChromeUrl), content::PAGE_TRANSITION_LINK); |
| 921 } else { |
| 922 content::RecordAction(UserMetricsAction("UpdateChrome")); |
| 923 browser->window()->ShowUpdateChromeDialog(); |
| 924 } |
914 } | 925 } |
915 | 926 |
916 void ToggleSpeechInput(Browser* browser) { | 927 void ToggleSpeechInput(Browser* browser) { |
917 browser->tab_strip_model()->GetActiveWebContents()-> | 928 browser->tab_strip_model()->GetActiveWebContents()-> |
918 GetRenderViewHost()->ToggleSpeechInput(); | 929 GetRenderViewHost()->ToggleSpeechInput(); |
919 } | 930 } |
920 | 931 |
921 bool CanRequestTabletSite(WebContents* current_tab) { | 932 bool CanRequestTabletSite(WebContents* current_tab) { |
922 if (!current_tab) | 933 if (!current_tab) |
923 return false; | 934 return false; |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1085 Browser::CreateParams::CreateForApp( | 1096 Browser::CreateParams::CreateForApp( |
1086 Browser::TYPE_POPUP, app_name, gfx::Rect(), browser->profile())); | 1097 Browser::TYPE_POPUP, app_name, gfx::Rect(), browser->profile())); |
1087 app_browser->tab_strip_model()->AppendWebContents(contents, true); | 1098 app_browser->tab_strip_model()->AppendWebContents(contents, true); |
1088 | 1099 |
1089 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; | 1100 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; |
1090 contents->GetRenderViewHost()->SyncRendererPrefs(); | 1101 contents->GetRenderViewHost()->SyncRendererPrefs(); |
1091 app_browser->window()->Show(); | 1102 app_browser->window()->Show(); |
1092 } | 1103 } |
1093 | 1104 |
1094 } // namespace chrome | 1105 } // namespace chrome |
OLD | NEW |