| 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 842 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 872 } | 873 } |
| 873 AddItemWithStringId(IDC_SHOW_DOWNLOADS, IDS_SHOW_DOWNLOADS); | 874 AddItemWithStringId(IDC_SHOW_DOWNLOADS, IDS_SHOW_DOWNLOADS); |
| 874 if (!browser_->profile()->IsGuestSession()) { | 875 if (!browser_->profile()->IsGuestSession()) { |
| 875 bookmark_sub_menu_model_.reset(new BookmarkSubMenuModel(this, browser_)); | 876 bookmark_sub_menu_model_.reset(new BookmarkSubMenuModel(this, browser_)); |
| 876 AddSubMenuWithStringId(IDC_BOOKMARKS_MENU, IDS_BOOKMARKS_MENU, | 877 AddSubMenuWithStringId(IDC_BOOKMARKS_MENU, IDS_BOOKMARKS_MENU, |
| 877 bookmark_sub_menu_model_.get()); | 878 bookmark_sub_menu_model_.get()); |
| 878 } | 879 } |
| 879 | 880 |
| 880 CreateZoomMenu(); | 881 CreateZoomMenu(); |
| 881 AddItemWithStringId(IDC_PRINT, IDS_PRINT); | 882 AddItemWithStringId(IDC_PRINT, IDS_PRINT); |
| 882 if (switches::MediaRouterEnabled() && !browser()->profile()->IsOffTheRecord()) | 883 if (media_router::MediaRouterEnabled() && |
| 884 !browser()->profile()->IsOffTheRecord()) { |
| 883 AddItemWithStringId(IDC_ROUTE_MEDIA, IDS_MEDIA_ROUTER_MENU_ITEM_TITLE); | 885 AddItemWithStringId(IDC_ROUTE_MEDIA, IDS_MEDIA_ROUTER_MENU_ITEM_TITLE); |
| 886 } |
| 887 |
| 884 AddItemWithStringId(IDC_FIND, IDS_FIND); | 888 AddItemWithStringId(IDC_FIND, IDS_FIND); |
| 885 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 889 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 886 switches::kEnableDomDistiller)) | 890 switches::kEnableDomDistiller)) |
| 887 AddItemWithStringId(IDC_DISTILL_PAGE, IDS_DISTILL_PAGE); | 891 AddItemWithStringId(IDC_DISTILL_PAGE, IDS_DISTILL_PAGE); |
| 888 tools_menu_model_.reset(new ToolsMenuModel(this, browser_)); | 892 tools_menu_model_.reset(new ToolsMenuModel(this, browser_)); |
| 889 AddSubMenuWithStringId( | 893 AddSubMenuWithStringId( |
| 890 IDC_MORE_TOOLS_MENU, IDS_MORE_TOOLS_MENU, tools_menu_model_.get()); | 894 IDC_MORE_TOOLS_MENU, IDS_MORE_TOOLS_MENU, tools_menu_model_.get()); |
| 891 // Append the full menu including separators. The final separator only gets | 895 // Append the full menu including separators. The final separator only gets |
| 892 // appended when this is a touch menu - otherwise it would get added twice. | 896 // appended when this is a touch menu - otherwise it would get added twice. |
| 893 CreateCutCopyPasteMenu(); | 897 CreateCutCopyPasteMenu(); |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1017 ->GetZoomPercent(); | 1021 ->GetZoomPercent(); |
| 1018 } | 1022 } |
| 1019 zoom_label_ = l10n_util::GetStringFUTF16( | 1023 zoom_label_ = l10n_util::GetStringFUTF16( |
| 1020 IDS_ZOOM_PERCENT, base::IntToString16(zoom_percent)); | 1024 IDS_ZOOM_PERCENT, base::IntToString16(zoom_percent)); |
| 1021 } | 1025 } |
| 1022 | 1026 |
| 1023 void AppMenuModel::OnZoomLevelChanged( | 1027 void AppMenuModel::OnZoomLevelChanged( |
| 1024 const content::HostZoomMap::ZoomLevelChange& change) { | 1028 const content::HostZoomMap::ZoomLevelChange& change) { |
| 1025 UpdateZoomControls(); | 1029 UpdateZoomControls(); |
| 1026 } | 1030 } |
| OLD | NEW |