Chromium Code Reviews| 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/wrench_menu_model.h" | 5 #include "chrome/browser/ui/toolbar/wrench_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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 74 #include "base/win/windows_version.h" | 74 #include "base/win/windows_version.h" |
| 75 #include "chrome/browser/enumerate_modules_model_win.h" | 75 #include "chrome/browser/enumerate_modules_model_win.h" |
| 76 #include "chrome/browser/ui/metro_pin_tab_helper_win.h" | 76 #include "chrome/browser/ui/metro_pin_tab_helper_win.h" |
| 77 #include "content/public/browser/gpu_data_manager.h" | 77 #include "content/public/browser/gpu_data_manager.h" |
| 78 #endif | 78 #endif |
| 79 | 79 |
| 80 #if defined(USE_ASH) | 80 #if defined(USE_ASH) |
| 81 #include "ash/shell.h" | 81 #include "ash/shell.h" |
| 82 #endif | 82 #endif |
| 83 | 83 |
| 84 #if defined(ENABLE_MEDIA_ROUTER) | |
| 85 #include "chrome/browser/media/router/media_router_feature.h" | |
| 86 #endif | |
| 87 | |
| 84 using base::UserMetricsAction; | 88 using base::UserMetricsAction; |
| 85 using content::WebContents; | 89 using content::WebContents; |
| 86 | 90 |
| 87 namespace { | 91 namespace { |
| 88 | 92 |
| 89 #if defined(OS_MACOSX) | 93 #if defined(OS_MACOSX) |
| 90 // An empty command used because of a bug in AppKit menus. | 94 // An empty command used because of a bug in AppKit menus. |
| 91 // See comment in CreateActionToolbarOverflowMenu(). | 95 // See comment in CreateActionToolbarOverflowMenu(). |
| 92 const int kEmptyMenuItemCommand = 0; | 96 const int kEmptyMenuItemCommand = 0; |
| 93 #endif | 97 #endif |
| (...skipping 788 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 882 } | 886 } |
| 883 AddItemWithStringId(IDC_SHOW_DOWNLOADS, IDS_SHOW_DOWNLOADS); | 887 AddItemWithStringId(IDC_SHOW_DOWNLOADS, IDS_SHOW_DOWNLOADS); |
| 884 if (!browser_->profile()->IsGuestSession()) { | 888 if (!browser_->profile()->IsGuestSession()) { |
| 885 bookmark_sub_menu_model_.reset(new BookmarkSubMenuModel(this, browser_)); | 889 bookmark_sub_menu_model_.reset(new BookmarkSubMenuModel(this, browser_)); |
| 886 AddSubMenuWithStringId(IDC_BOOKMARKS_MENU, IDS_BOOKMARKS_MENU, | 890 AddSubMenuWithStringId(IDC_BOOKMARKS_MENU, IDS_BOOKMARKS_MENU, |
| 887 bookmark_sub_menu_model_.get()); | 891 bookmark_sub_menu_model_.get()); |
| 888 } | 892 } |
| 889 | 893 |
| 890 CreateZoomMenu(); | 894 CreateZoomMenu(); |
| 891 AddItemWithStringId(IDC_PRINT, IDS_PRINT); | 895 AddItemWithStringId(IDC_PRINT, IDS_PRINT); |
| 892 if (switches::MediaRouterEnabled() && !browser()->profile()->IsOffTheRecord()) | 896 #if defined(ENABLE_MEDIA_ROUTER) |
| 897 if (media_router::MediaRouterEnabled() && | |
| 898 !browser()->profile()->IsOffTheRecord()) | |
|
msw
2015/10/23 20:18:43
nit: add curly braces
imcheng
2015/10/23 21:39:26
Done.
| |
| 893 AddItemWithStringId(IDC_ROUTE_MEDIA, IDS_MEDIA_ROUTER_MENU_ITEM_TITLE); | 899 AddItemWithStringId(IDC_ROUTE_MEDIA, IDS_MEDIA_ROUTER_MENU_ITEM_TITLE); |
| 900 #endif | |
| 894 AddItemWithStringId(IDC_FIND, IDS_FIND); | 901 AddItemWithStringId(IDC_FIND, IDS_FIND); |
| 895 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 902 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 896 switches::kEnableDomDistiller)) | 903 switches::kEnableDomDistiller)) |
| 897 AddItemWithStringId(IDC_DISTILL_PAGE, IDS_DISTILL_PAGE); | 904 AddItemWithStringId(IDC_DISTILL_PAGE, IDS_DISTILL_PAGE); |
| 898 tools_menu_model_.reset(new ToolsMenuModel(this, browser_)); | 905 tools_menu_model_.reset(new ToolsMenuModel(this, browser_)); |
| 899 AddSubMenuWithStringId( | 906 AddSubMenuWithStringId( |
| 900 IDC_MORE_TOOLS_MENU, IDS_MORE_TOOLS_MENU, tools_menu_model_.get()); | 907 IDC_MORE_TOOLS_MENU, IDS_MORE_TOOLS_MENU, tools_menu_model_.get()); |
| 901 // Append the full menu including separators. The final separator only gets | 908 // Append the full menu including separators. The final separator only gets |
| 902 // appended when this is a touch menu - otherwise it would get added twice. | 909 // appended when this is a touch menu - otherwise it would get added twice. |
| 903 CreateCutCopyPasteMenu(); | 910 CreateCutCopyPasteMenu(); |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1027 ->GetZoomPercent(); | 1034 ->GetZoomPercent(); |
| 1028 } | 1035 } |
| 1029 zoom_label_ = l10n_util::GetStringFUTF16( | 1036 zoom_label_ = l10n_util::GetStringFUTF16( |
| 1030 IDS_ZOOM_PERCENT, base::IntToString16(zoom_percent)); | 1037 IDS_ZOOM_PERCENT, base::IntToString16(zoom_percent)); |
| 1031 } | 1038 } |
| 1032 | 1039 |
| 1033 void WrenchMenuModel::OnZoomLevelChanged( | 1040 void WrenchMenuModel::OnZoomLevelChanged( |
| 1034 const content::HostZoomMap::ZoomLevelChange& change) { | 1041 const content::HostZoomMap::ZoomLevelChange& change) { |
| 1035 UpdateZoomControls(); | 1042 UpdateZoomControls(); |
| 1036 } | 1043 } |
| OLD | NEW |