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" |
11 #include "base/prefs/pref_service.h" | 11 #include "base/prefs/pref_service.h" |
12 #include "base/strings/string_number_conversions.h" | 12 #include "base/strings/string_number_conversions.h" |
13 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
14 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
15 #include "chrome/app/chrome_command_ids.h" | 15 #include "chrome/app/chrome_command_ids.h" |
16 #include "chrome/browser/browser_process.h" | 16 #include "chrome/browser/browser_process.h" |
17 #include "chrome/browser/defaults.h" | 17 #include "chrome/browser/defaults.h" |
18 #include "chrome/browser/extensions/extension_toolbar_model.h" | |
19 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
20 #include "chrome/browser/profiles/profile_manager.h" | 19 #include "chrome/browser/profiles/profile_manager.h" |
21 #include "chrome/browser/search/search.h" | 20 #include "chrome/browser/search/search.h" |
22 #include "chrome/browser/signin/signin_manager_factory.h" | 21 #include "chrome/browser/signin/signin_manager_factory.h" |
23 #include "chrome/browser/signin/signin_ui_util.h" | 22 #include "chrome/browser/signin/signin_ui_util.h" |
24 #include "chrome/browser/task_manager/task_manager.h" | 23 #include "chrome/browser/task_manager/task_manager.h" |
25 #include "chrome/browser/ui/bookmarks/bookmark_utils.h" | 24 #include "chrome/browser/ui/bookmarks/bookmark_utils.h" |
26 #include "chrome/browser/ui/browser.h" | 25 #include "chrome/browser/ui/browser.h" |
27 #include "chrome/browser/ui/browser_commands.h" | 26 #include "chrome/browser/ui/browser_commands.h" |
28 #include "chrome/browser/ui/browser_finder.h" | 27 #include "chrome/browser/ui/browser_finder.h" |
(...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
734 SetIcon(GetIndexOfCommandId(error->MenuItemCommandID()), | 733 SetIcon(GetIndexOfCommandId(error->MenuItemCommandID()), |
735 image); | 734 image); |
736 } | 735 } |
737 } | 736 } |
738 } | 737 } |
739 } | 738 } |
740 | 739 |
741 void WrenchMenuModel::CreateExtensionToolbarOverflowMenu() { | 740 void WrenchMenuModel::CreateExtensionToolbarOverflowMenu() { |
742 #if defined(TOOLKIT_VIEWS) | 741 #if defined(TOOLKIT_VIEWS) |
743 AddItem(IDC_EXTENSIONS_OVERFLOW_MENU, base::string16()); | 742 AddItem(IDC_EXTENSIONS_OVERFLOW_MENU, base::string16()); |
744 // We only add the separator if there are > 0 items to show in the overflow. | 743 // TODO(devlin): Add the separator only if there are > 0 icons to show. |
745 extensions::ExtensionToolbarModel* toolbar_model = | 744 AddSeparator(ui::UPPER_SEPARATOR); |
746 extensions::ExtensionToolbarModel::Get(browser_->profile()); | |
747 // A count of -1 means all actions are visible. | |
748 if (toolbar_model->GetVisibleIconCount() != -1) | |
749 AddSeparator(ui::UPPER_SEPARATOR); | |
750 #endif // defined(TOOLKIT_VIEWS) | 745 #endif // defined(TOOLKIT_VIEWS) |
751 } | 746 } |
752 | 747 |
753 void WrenchMenuModel::CreateCutCopyPasteMenu(bool new_menu) { | 748 void WrenchMenuModel::CreateCutCopyPasteMenu(bool new_menu) { |
754 AddSeparator(new_menu ? ui::LOWER_SEPARATOR : ui::NORMAL_SEPARATOR); | 749 AddSeparator(new_menu ? ui::LOWER_SEPARATOR : ui::NORMAL_SEPARATOR); |
755 | 750 |
756 #if defined(OS_POSIX) && !defined(TOOLKIT_VIEWS) | 751 #if defined(OS_POSIX) && !defined(TOOLKIT_VIEWS) |
757 // WARNING: Mac does not use the ButtonMenuItemModel, but instead defines the | 752 // WARNING: Mac does not use the ButtonMenuItemModel, but instead defines the |
758 // layout for this menu item in Toolbar.xib. It does, however, use the | 753 // layout for this menu item in Toolbar.xib. It does, however, use the |
759 // command_id value from AddButtonItem() to identify this special item. | 754 // command_id value from AddButtonItem() to identify this special item. |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
813 ->GetZoomPercent(); | 808 ->GetZoomPercent(); |
814 } | 809 } |
815 zoom_label_ = l10n_util::GetStringFUTF16( | 810 zoom_label_ = l10n_util::GetStringFUTF16( |
816 IDS_ZOOM_PERCENT, base::IntToString16(zoom_percent)); | 811 IDS_ZOOM_PERCENT, base::IntToString16(zoom_percent)); |
817 } | 812 } |
818 | 813 |
819 void WrenchMenuModel::OnZoomLevelChanged( | 814 void WrenchMenuModel::OnZoomLevelChanged( |
820 const content::HostZoomMap::ZoomLevelChange& change) { | 815 const content::HostZoomMap::ZoomLevelChange& change) { |
821 UpdateZoomControls(); | 816 UpdateZoomControls(); |
822 } | 817 } |
OLD | NEW |