Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(505)

Side by Side Diff: chrome/browser/ui/views/toolbar/app_menu.cc

Issue 1417423003: chrome: Rename WrenchMenuModel to AppMenuModel. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/views/toolbar/app_menu.h" 5 #include "chrome/browser/ui/views/toolbar/app_menu.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <set> 9 #include <set>
10 10
11 #include "base/metrics/histogram.h" 11 #include "base/metrics/histogram.h"
12 #include "base/strings/string_number_conversions.h" 12 #include "base/strings/string_number_conversions.h"
13 #include "base/strings/utf_string_conversions.h" 13 #include "base/strings/utf_string_conversions.h"
14 #include "chrome/app/chrome_command_ids.h" 14 #include "chrome/app/chrome_command_ids.h"
15 #include "chrome/browser/bookmarks/bookmark_model_factory.h" 15 #include "chrome/browser/bookmarks/bookmark_model_factory.h"
16 #include "chrome/browser/bookmarks/bookmark_stats.h" 16 #include "chrome/browser/bookmarks/bookmark_stats.h"
17 #include "chrome/browser/chrome_notification_types.h" 17 #include "chrome/browser/chrome_notification_types.h"
18 #include "chrome/browser/profiles/profile.h" 18 #include "chrome/browser/profiles/profile.h"
19 #include "chrome/browser/search/search.h" 19 #include "chrome/browser/search/search.h"
20 #include "chrome/browser/ui/browser.h" 20 #include "chrome/browser/ui/browser.h"
21 #include "chrome/browser/ui/browser_window.h" 21 #include "chrome/browser/ui/browser_window.h"
22 #include "chrome/browser/ui/tabs/tab_strip_model.h" 22 #include "chrome/browser/ui/tabs/tab_strip_model.h"
23 #include "chrome/browser/ui/toolbar/wrench_menu_model.h" 23 #include "chrome/browser/ui/toolbar/app_menu_model.h"
24 #include "chrome/browser/ui/views/bookmarks/bookmark_menu_delegate.h" 24 #include "chrome/browser/ui/views/bookmarks/bookmark_menu_delegate.h"
25 #include "chrome/browser/ui/views/toolbar/app_menu_observer.h" 25 #include "chrome/browser/ui/views/toolbar/app_menu_observer.h"
26 #include "chrome/browser/ui/views/toolbar/extension_toolbar_menu_view.h" 26 #include "chrome/browser/ui/views/toolbar/extension_toolbar_menu_view.h"
27 #include "chrome/grit/generated_resources.h" 27 #include "chrome/grit/generated_resources.h"
28 #include "components/bookmarks/browser/bookmark_model.h" 28 #include "components/bookmarks/browser/bookmark_model.h"
29 #include "components/ui/zoom/page_zoom.h" 29 #include "components/ui/zoom/page_zoom.h"
30 #include "components/ui/zoom/zoom_controller.h" 30 #include "components/ui/zoom/zoom_controller.h"
31 #include "components/ui/zoom/zoom_event_manager.h" 31 #include "components/ui/zoom/zoom_event_manager.h"
32 #include "content/public/browser/host_zoom_map.h" 32 #include "content/public/browser/host_zoom_map.h"
33 #include "content/public/browser/notification_observer.h" 33 #include "content/public/browser/notification_observer.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 const int kZoomLabelHorizontalPadding = 2; 90 const int kZoomLabelHorizontalPadding = 2;
91 #endif 91 #endif
92 92
93 // Returns true if |command_id| identifies a bookmark menu item. 93 // Returns true if |command_id| identifies a bookmark menu item.
94 bool IsBookmarkCommand(int command_id) { 94 bool IsBookmarkCommand(int command_id) {
95 return command_id >= IDC_FIRST_BOOKMARK_MENU; 95 return command_id >= IDC_FIRST_BOOKMARK_MENU;
96 } 96 }
97 97
98 // Returns true if |command_id| identifies a recent tabs menu item. 98 // Returns true if |command_id| identifies a recent tabs menu item.
99 bool IsRecentTabsCommand(int command_id) { 99 bool IsRecentTabsCommand(int command_id) {
100 return command_id >= WrenchMenuModel::kMinRecentTabsCommandId && 100 return command_id >= AppMenuModel::kMinRecentTabsCommandId &&
101 command_id <= WrenchMenuModel::kMaxRecentTabsCommandId; 101 command_id <= AppMenuModel::kMaxRecentTabsCommandId;
102 } 102 }
103 103
104 // Subclass of ImageButton whose preferred size includes the size of the border. 104 // Subclass of ImageButton whose preferred size includes the size of the border.
105 class FullscreenButton : public ImageButton { 105 class FullscreenButton : public ImageButton {
106 public: 106 public:
107 explicit FullscreenButton(views::ButtonListener* listener) 107 explicit FullscreenButton(views::ButtonListener* listener)
108 : ImageButton(listener) { } 108 : ImageButton(listener) { }
109 109
110 // Overridden from ImageButton. 110 // Overridden from ImageButton.
111 gfx::Size GetPreferredSize() const override { 111 gfx::Size GetPreferredSize() const override {
(...skipping 1153 matching lines...) Expand 10 before | Expand all | Expand 10 after
1265 0, 1265 0,
1266 BookmarkMenuDelegate::SHOW_PERMANENT_FOLDERS, 1266 BookmarkMenuDelegate::SHOW_PERMANENT_FOLDERS,
1267 BOOKMARK_LAUNCH_LOCATION_WRENCH_MENU); 1267 BOOKMARK_LAUNCH_LOCATION_WRENCH_MENU);
1268 } 1268 }
1269 1269
1270 int AppMenu::ModelIndexFromCommandId(int command_id) const { 1270 int AppMenu::ModelIndexFromCommandId(int command_id) const {
1271 CommandIDToEntry::const_iterator ix = command_id_to_entry_.find(command_id); 1271 CommandIDToEntry::const_iterator ix = command_id_to_entry_.find(command_id);
1272 DCHECK(ix != command_id_to_entry_.end()); 1272 DCHECK(ix != command_id_to_entry_.end());
1273 return ix->second.second; 1273 return ix->second.second;
1274 } 1274 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/toolbar/app_menu.h ('k') | chrome/browser/ui/views/toolbar/app_menu_button.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698