OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/toolbar/app_menu_model.h" | 5 #include "chrome/browser/ui/toolbar/app_menu_model.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
169 } | 169 } |
170 | 170 |
171 ToolsMenuModel::~ToolsMenuModel() {} | 171 ToolsMenuModel::~ToolsMenuModel() {} |
172 | 172 |
173 // More tools submenu is constructed as follows: | 173 // More tools submenu is constructed as follows: |
174 // - Page specific actions overflow (save page, adding to desktop). | 174 // - Page specific actions overflow (save page, adding to desktop). |
175 // - Browser / OS level tools (extensions, task manager). | 175 // - Browser / OS level tools (extensions, task manager). |
176 // - Developer tools. | 176 // - Developer tools. |
177 // - Option to enable profiling. | 177 // - Option to enable profiling. |
178 void ToolsMenuModel::Build(Browser* browser) { | 178 void ToolsMenuModel::Build(Browser* browser) { |
179 bool show_create_shortcuts = true; | |
180 #if defined(OS_CHROMEOS) || defined(OS_MACOSX) || defined(USE_ASH) | |
181 show_create_shortcuts = false; | |
182 #endif | |
183 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 179 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
184 switches::kEnableSaveAsMenuLabelExperiment) || | 180 switches::kEnableSaveAsMenuLabelExperiment) || |
185 base::FieldTrialList::FindFullName("SaveAsMenuText") == "download") { | 181 base::FieldTrialList::FindFullName("SaveAsMenuText") == "download") { |
186 AddItemWithStringId(IDC_SAVE_PAGE, IDS_DOWNLOAD_PAGE); | 182 AddItemWithStringId(IDC_SAVE_PAGE, IDS_DOWNLOAD_PAGE); |
187 } else { | 183 } else { |
188 AddItemWithStringId(IDC_SAVE_PAGE, IDS_SAVE_PAGE); | 184 AddItemWithStringId(IDC_SAVE_PAGE, IDS_SAVE_PAGE); |
189 } | 185 } |
190 | 186 |
191 if (extensions::util::IsNewBookmarkAppsEnabled()) { | 187 if (extensions::util::IsNewBookmarkAppsEnabled()) { |
192 int string_id = IDS_ADD_TO_DESKTOP; | 188 int string_id = IDS_ADD_TO_DESKTOP; |
193 #if defined(OS_MACOSX) | 189 #if defined(OS_MACOSX) |
194 string_id = IDS_ADD_TO_APPLICATIONS; | 190 string_id = IDS_ADD_TO_APPLICATIONS; |
195 #endif | 191 #endif |
196 #if defined(USE_ASH) | 192 #if defined(USE_ASH) |
197 string_id = IDS_ADD_TO_SHELF; | 193 string_id = IDS_ADD_TO_SHELF; |
198 #endif // defined(USE_ASH) | 194 #endif // defined(USE_ASH) |
199 AddItemWithStringId(IDC_CREATE_HOSTED_APP, string_id); | 195 AddItemWithStringId(IDC_CREATE_HOSTED_APP, string_id); |
200 } else if (show_create_shortcuts) { | |
201 AddItemWithStringId(IDC_CREATE_SHORTCUTS, IDS_CREATE_SHORTCUTS); | |
grt (UTC plus 2)
2017/04/05 08:28:00
please remove IDS_CREATE_SHORTCUTS from chrome/app
tapted
2017/04/05 12:35:44
Done.
| |
202 } | 196 } |
203 | 197 |
204 AddSeparator(ui::NORMAL_SEPARATOR); | 198 AddSeparator(ui::NORMAL_SEPARATOR); |
205 AddItemWithStringId(IDC_CLEAR_BROWSING_DATA, IDS_CLEAR_BROWSING_DATA); | 199 AddItemWithStringId(IDC_CLEAR_BROWSING_DATA, IDS_CLEAR_BROWSING_DATA); |
206 AddItemWithStringId(IDC_MANAGE_EXTENSIONS, IDS_SHOW_EXTENSIONS); | 200 AddItemWithStringId(IDC_MANAGE_EXTENSIONS, IDS_SHOW_EXTENSIONS); |
207 if (chrome::CanOpenTaskManager()) | 201 if (chrome::CanOpenTaskManager()) |
208 AddItemWithStringId(IDC_TASK_MANAGER, IDS_TASK_MANAGER); | 202 AddItemWithStringId(IDC_TASK_MANAGER, IDS_TASK_MANAGER); |
209 #if defined(OS_CHROMEOS) | 203 #if defined(OS_CHROMEOS) |
210 AddItemWithStringId(IDC_TAKE_SCREENSHOT, IDS_TAKE_SCREENSHOT); | 204 AddItemWithStringId(IDC_TAKE_SCREENSHOT, IDS_TAKE_SCREENSHOT); |
211 #endif | 205 #endif |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
430 break; | 424 break; |
431 | 425 |
432 // Tools menu. | 426 // Tools menu. |
433 case IDC_CREATE_HOSTED_APP: | 427 case IDC_CREATE_HOSTED_APP: |
434 if (!uma_action_recorded_) { | 428 if (!uma_action_recorded_) { |
435 UMA_HISTOGRAM_MEDIUM_TIMES("WrenchMenu.TimeToAction.CreateHostedApp", | 429 UMA_HISTOGRAM_MEDIUM_TIMES("WrenchMenu.TimeToAction.CreateHostedApp", |
436 delta); | 430 delta); |
437 } | 431 } |
438 LogMenuAction(MENU_ACTION_CREATE_HOSTED_APP); | 432 LogMenuAction(MENU_ACTION_CREATE_HOSTED_APP); |
439 break; | 433 break; |
440 case IDC_CREATE_SHORTCUTS: | |
441 if (!uma_action_recorded_) | |
442 UMA_HISTOGRAM_MEDIUM_TIMES("WrenchMenu.TimeToAction.CreateShortcuts", | |
grt (UTC plus 2)
2017/04/05 08:28:00
mark this suffix as obsolete in histograms.xml
tapted
2017/04/05 12:35:43
I think I got this one already :). (just.. histogr
grt (UTC plus 2)
2017/04/05 13:32:05
Indeed! Apologies for the false alarm.
| |
443 delta); | |
444 LogMenuAction(MENU_ACTION_CREATE_SHORTCUTS); | |
445 break; | |
446 case IDC_MANAGE_EXTENSIONS: | 434 case IDC_MANAGE_EXTENSIONS: |
447 if (!uma_action_recorded_) { | 435 if (!uma_action_recorded_) { |
448 UMA_HISTOGRAM_MEDIUM_TIMES("WrenchMenu.TimeToAction.ManageExtensions", | 436 UMA_HISTOGRAM_MEDIUM_TIMES("WrenchMenu.TimeToAction.ManageExtensions", |
449 delta); | 437 delta); |
450 } | 438 } |
451 LogMenuAction(MENU_ACTION_MANAGE_EXTENSIONS); | 439 LogMenuAction(MENU_ACTION_MANAGE_EXTENSIONS); |
452 break; | 440 break; |
453 case IDC_TASK_MANAGER: | 441 case IDC_TASK_MANAGER: |
454 if (!uma_action_recorded_) { | 442 if (!uma_action_recorded_) { |
455 UMA_HISTOGRAM_MEDIUM_TIMES("WrenchMenu.TimeToAction.TaskManager", | 443 UMA_HISTOGRAM_MEDIUM_TIMES("WrenchMenu.TimeToAction.TaskManager", |
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
862 browser_->tab_strip_model()->GetActiveWebContents()) | 850 browser_->tab_strip_model()->GetActiveWebContents()) |
863 ->GetZoomPercent(); | 851 ->GetZoomPercent(); |
864 } | 852 } |
865 zoom_label_ = base::FormatPercent(zoom_percent); | 853 zoom_label_ = base::FormatPercent(zoom_percent); |
866 } | 854 } |
867 | 855 |
868 void AppMenuModel::OnZoomLevelChanged( | 856 void AppMenuModel::OnZoomLevelChanged( |
869 const content::HostZoomMap::ZoomLevelChange& change) { | 857 const content::HostZoomMap::ZoomLevelChange& change) { |
870 UpdateZoomControls(); | 858 UpdateZoomControls(); |
871 } | 859 } |
OLD | NEW |