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" | |
18 #include "chrome/browser/profiles/profile.h" | 19 #include "chrome/browser/profiles/profile.h" |
19 #include "chrome/browser/profiles/profile_manager.h" | 20 #include "chrome/browser/profiles/profile_manager.h" |
20 #include "chrome/browser/search/search.h" | 21 #include "chrome/browser/search/search.h" |
21 #include "chrome/browser/signin/signin_manager_factory.h" | 22 #include "chrome/browser/signin/signin_manager_factory.h" |
22 #include "chrome/browser/signin/signin_ui_util.h" | 23 #include "chrome/browser/signin/signin_ui_util.h" |
23 #include "chrome/browser/task_manager/task_manager.h" | 24 #include "chrome/browser/task_manager/task_manager.h" |
24 #include "chrome/browser/ui/bookmarks/bookmark_utils.h" | 25 #include "chrome/browser/ui/bookmarks/bookmark_utils.h" |
25 #include "chrome/browser/ui/browser.h" | 26 #include "chrome/browser/ui/browser.h" |
26 #include "chrome/browser/ui/browser_commands.h" | 27 #include "chrome/browser/ui/browser_commands.h" |
27 #include "chrome/browser/ui/browser_finder.h" | 28 #include "chrome/browser/ui/browser_finder.h" |
(...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
734 SetIcon(GetIndexOfCommandId(error->MenuItemCommandID()), | 735 SetIcon(GetIndexOfCommandId(error->MenuItemCommandID()), |
735 image); | 736 image); |
736 } | 737 } |
737 } | 738 } |
738 } | 739 } |
739 } | 740 } |
740 | 741 |
741 void WrenchMenuModel::CreateExtensionToolbarOverflowMenu() { | 742 void WrenchMenuModel::CreateExtensionToolbarOverflowMenu() { |
742 #if defined(TOOLKIT_VIEWS) | 743 #if defined(TOOLKIT_VIEWS) |
743 AddItem(IDC_EXTENSIONS_OVERFLOW_MENU, base::string16()); | 744 AddItem(IDC_EXTENSIONS_OVERFLOW_MENU, base::string16()); |
744 // TODO(devlin): Add the separator only if there are > 0 icons to show. | 745 // We only add the separator if there are > 0 items to show in the overflow. |
745 AddSeparator(ui::UPPER_SEPARATOR); | 746 extensions::ExtensionToolbarModel* toolbar_model = |
747 extensions::ExtensionToolbarModel::Get(browser_->profile()); | |
748 // A count of -1 means all actions are visible. | |
749 if (toolbar_model->GetVisibleIconCount() != -1) | |
Finnur
2014/07/18 10:40:39
Hah... somehow I thought this would be more compli
Devlin
2014/07/18 15:44:32
I'm pretty sure that we *should* add this if the c
Finnur
2014/07/18 15:53:51
Ah, yes.
| |
750 AddSeparator(ui::UPPER_SEPARATOR); | |
746 #endif // defined(TOOLKIT_VIEWS) | 751 #endif // defined(TOOLKIT_VIEWS) |
747 } | 752 } |
748 | 753 |
749 void WrenchMenuModel::CreateCutCopyPasteMenu(bool new_menu) { | 754 void WrenchMenuModel::CreateCutCopyPasteMenu(bool new_menu) { |
750 AddSeparator(new_menu ? ui::LOWER_SEPARATOR : ui::NORMAL_SEPARATOR); | 755 AddSeparator(new_menu ? ui::LOWER_SEPARATOR : ui::NORMAL_SEPARATOR); |
751 | 756 |
752 #if defined(OS_POSIX) && !defined(TOOLKIT_VIEWS) | 757 #if defined(OS_POSIX) && !defined(TOOLKIT_VIEWS) |
753 // WARNING: Mac does not use the ButtonMenuItemModel, but instead defines the | 758 // WARNING: Mac does not use the ButtonMenuItemModel, but instead defines the |
754 // layout for this menu item in Toolbar.xib. It does, however, use the | 759 // layout for this menu item in Toolbar.xib. It does, however, use the |
755 // command_id value from AddButtonItem() to identify this special item. | 760 // command_id value from AddButtonItem() to identify this special item. |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
809 ->GetZoomPercent(); | 814 ->GetZoomPercent(); |
810 } | 815 } |
811 zoom_label_ = l10n_util::GetStringFUTF16( | 816 zoom_label_ = l10n_util::GetStringFUTF16( |
812 IDS_ZOOM_PERCENT, base::IntToString16(zoom_percent)); | 817 IDS_ZOOM_PERCENT, base::IntToString16(zoom_percent)); |
813 } | 818 } |
814 | 819 |
815 void WrenchMenuModel::OnZoomLevelChanged( | 820 void WrenchMenuModel::OnZoomLevelChanged( |
816 const content::HostZoomMap::ZoomLevelChange& change) { | 821 const content::HostZoomMap::ZoomLevelChange& change) { |
817 UpdateZoomControls(); | 822 UpdateZoomControls(); |
818 } | 823 } |
OLD | NEW |