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" |
11 #include "base/metrics/histogram.h" | 11 #include "base/metrics/histogram.h" |
12 #include "base/prefs/pref_service.h" | 12 #include "base/prefs/pref_service.h" |
13 #include "base/strings/string_number_conversions.h" | 13 #include "base/strings/string_number_conversions.h" |
14 #include "base/strings/string_util.h" | 14 #include "base/strings/string_util.h" |
15 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
16 #include "chrome/app/chrome_command_ids.h" | 16 #include "chrome/app/chrome_command_ids.h" |
17 #include "chrome/browser/browser_process.h" | 17 #include "chrome/browser/browser_process.h" |
18 #include "chrome/browser/defaults.h" | 18 #include "chrome/browser/defaults.h" |
19 #include "chrome/browser/extensions/extension_util.h" | 19 #include "chrome/browser/extensions/extension_util.h" |
| 20 #include "chrome/browser/media/router/media_router_feature.h" |
20 #include "chrome/browser/prefs/incognito_mode_prefs.h" | 21 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
21 #include "chrome/browser/profiles/profile.h" | 22 #include "chrome/browser/profiles/profile.h" |
22 #include "chrome/browser/profiles/profile_manager.h" | 23 #include "chrome/browser/profiles/profile_manager.h" |
23 #include "chrome/browser/search/search.h" | 24 #include "chrome/browser/search/search.h" |
24 #include "chrome/browser/signin/signin_manager_factory.h" | 25 #include "chrome/browser/signin/signin_manager_factory.h" |
25 #include "chrome/browser/signin/signin_ui_util.h" | 26 #include "chrome/browser/signin/signin_ui_util.h" |
26 #include "chrome/browser/task_manager/task_manager.h" | 27 #include "chrome/browser/task_manager/task_manager.h" |
27 #include "chrome/browser/ui/bookmarks/bookmark_utils.h" | 28 #include "chrome/browser/ui/bookmarks/bookmark_utils.h" |
28 #include "chrome/browser/ui/browser.h" | 29 #include "chrome/browser/ui/browser.h" |
29 #include "chrome/browser/ui/browser_commands.h" | 30 #include "chrome/browser/ui/browser_commands.h" |
(...skipping 849 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
879 } | 880 } |
880 AddItemWithStringId(IDC_SHOW_DOWNLOADS, IDS_SHOW_DOWNLOADS); | 881 AddItemWithStringId(IDC_SHOW_DOWNLOADS, IDS_SHOW_DOWNLOADS); |
881 if (!browser_->profile()->IsGuestSession()) { | 882 if (!browser_->profile()->IsGuestSession()) { |
882 bookmark_sub_menu_model_.reset(new BookmarkSubMenuModel(this, browser_)); | 883 bookmark_sub_menu_model_.reset(new BookmarkSubMenuModel(this, browser_)); |
883 AddSubMenuWithStringId(IDC_BOOKMARKS_MENU, IDS_BOOKMARKS_MENU, | 884 AddSubMenuWithStringId(IDC_BOOKMARKS_MENU, IDS_BOOKMARKS_MENU, |
884 bookmark_sub_menu_model_.get()); | 885 bookmark_sub_menu_model_.get()); |
885 } | 886 } |
886 | 887 |
887 CreateZoomMenu(); | 888 CreateZoomMenu(); |
888 AddItemWithStringId(IDC_PRINT, IDS_PRINT); | 889 AddItemWithStringId(IDC_PRINT, IDS_PRINT); |
889 if (switches::MediaRouterEnabled() && !browser()->profile()->IsOffTheRecord()) | 890 if (media_router::MediaRouterEnabled() && |
| 891 !browser()->profile()->IsOffTheRecord()) { |
890 AddItemWithStringId(IDC_ROUTE_MEDIA, IDS_MEDIA_ROUTER_MENU_ITEM_TITLE); | 892 AddItemWithStringId(IDC_ROUTE_MEDIA, IDS_MEDIA_ROUTER_MENU_ITEM_TITLE); |
| 893 } |
| 894 |
891 AddItemWithStringId(IDC_FIND, IDS_FIND); | 895 AddItemWithStringId(IDC_FIND, IDS_FIND); |
892 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 896 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
893 switches::kEnableDomDistiller)) | 897 switches::kEnableDomDistiller)) |
894 AddItemWithStringId(IDC_DISTILL_PAGE, IDS_DISTILL_PAGE); | 898 AddItemWithStringId(IDC_DISTILL_PAGE, IDS_DISTILL_PAGE); |
895 tools_menu_model_.reset(new ToolsMenuModel(this, browser_)); | 899 tools_menu_model_.reset(new ToolsMenuModel(this, browser_)); |
896 AddSubMenuWithStringId( | 900 AddSubMenuWithStringId( |
897 IDC_MORE_TOOLS_MENU, IDS_MORE_TOOLS_MENU, tools_menu_model_.get()); | 901 IDC_MORE_TOOLS_MENU, IDS_MORE_TOOLS_MENU, tools_menu_model_.get()); |
898 // Append the full menu including separators. The final separator only gets | 902 // Append the full menu including separators. The final separator only gets |
899 // appended when this is a touch menu - otherwise it would get added twice. | 903 // appended when this is a touch menu - otherwise it would get added twice. |
900 CreateCutCopyPasteMenu(); | 904 CreateCutCopyPasteMenu(); |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1024 ->GetZoomPercent(); | 1028 ->GetZoomPercent(); |
1025 } | 1029 } |
1026 zoom_label_ = l10n_util::GetStringFUTF16( | 1030 zoom_label_ = l10n_util::GetStringFUTF16( |
1027 IDS_ZOOM_PERCENT, base::IntToString16(zoom_percent)); | 1031 IDS_ZOOM_PERCENT, base::IntToString16(zoom_percent)); |
1028 } | 1032 } |
1029 | 1033 |
1030 void AppMenuModel::OnZoomLevelChanged( | 1034 void AppMenuModel::OnZoomLevelChanged( |
1031 const content::HostZoomMap::ZoomLevelChange& change) { | 1035 const content::HostZoomMap::ZoomLevelChange& change) { |
1032 UpdateZoomControls(); | 1036 UpdateZoomControls(); |
1033 } | 1037 } |
OLD | NEW |