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/toolbar/app_menu_model.h

Issue 1865213004: Convert //chrome/browser/ui from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 months 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 (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 #ifndef CHROME_BROWSER_UI_TOOLBAR_APP_MENU_MODEL_H_ 5 #ifndef CHROME_BROWSER_UI_TOOLBAR_APP_MENU_MODEL_H_
6 #define CHROME_BROWSER_UI_TOOLBAR_APP_MENU_MODEL_H_ 6 #define CHROME_BROWSER_UI_TOOLBAR_APP_MENU_MODEL_H_
7 7
8 #include <memory>
9
8 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
9 #include "base/macros.h" 11 #include "base/macros.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "base/time/time.h" 12 #include "base/time/time.h"
12 #include "base/timer/elapsed_timer.h" 13 #include "base/timer/elapsed_timer.h"
13 #include "chrome/browser/ui/tabs/tab_strip_model_observer.h" 14 #include "chrome/browser/ui/tabs/tab_strip_model_observer.h"
14 #include "content/public/browser/host_zoom_map.h" 15 #include "content/public/browser/host_zoom_map.h"
15 #include "content/public/browser/notification_observer.h" 16 #include "content/public/browser/notification_observer.h"
16 #include "content/public/browser/notification_registrar.h" 17 #include "content/public/browser/notification_registrar.h"
17 #include "ui/base/accelerators/accelerator.h" 18 #include "ui/base/accelerators/accelerator.h"
18 #include "ui/base/models/button_menu_item_model.h" 19 #include "ui/base/models/button_menu_item_model.h"
19 #include "ui/base/models/simple_menu_model.h" 20 #include "ui/base/models/simple_menu_model.h"
20 21
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 }; 110 };
110 111
111 class ToolsMenuModel : public ui::SimpleMenuModel { 112 class ToolsMenuModel : public ui::SimpleMenuModel {
112 public: 113 public:
113 ToolsMenuModel(ui::SimpleMenuModel::Delegate* delegate, Browser* browser); 114 ToolsMenuModel(ui::SimpleMenuModel::Delegate* delegate, Browser* browser);
114 ~ToolsMenuModel() override; 115 ~ToolsMenuModel() override;
115 116
116 private: 117 private:
117 void Build(Browser* browser); 118 void Build(Browser* browser);
118 119
119 scoped_ptr<EncodingMenuModel> encoding_menu_model_; 120 std::unique_ptr<EncodingMenuModel> encoding_menu_model_;
120 121
121 DISALLOW_COPY_AND_ASSIGN(ToolsMenuModel); 122 DISALLOW_COPY_AND_ASSIGN(ToolsMenuModel);
122 }; 123 };
123 124
124 // A menu model that builds the contents of the app menu. 125 // A menu model that builds the contents of the app menu.
125 class AppMenuModel : public ui::SimpleMenuModel, 126 class AppMenuModel : public ui::SimpleMenuModel,
126 public ui::SimpleMenuModel::Delegate, 127 public ui::SimpleMenuModel::Delegate,
127 public ui::ButtonMenuItemModel::Delegate, 128 public ui::ButtonMenuItemModel::Delegate,
128 public TabStripModelObserver, 129 public TabStripModelObserver,
129 public content::NotificationObserver { 130 public content::NotificationObserver {
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 // Time menu has been open. Used by LogMenuMetrics() to record the time 215 // Time menu has been open. Used by LogMenuMetrics() to record the time
215 // to action when the user selects a menu item. 216 // to action when the user selects a menu item.
216 base::ElapsedTimer timer_; 217 base::ElapsedTimer timer_;
217 218
218 // Whether a UMA menu action has been recorded since the menu is open. 219 // Whether a UMA menu action has been recorded since the menu is open.
219 // Only the first time to action is recorded since some commands 220 // Only the first time to action is recorded since some commands
220 // (zoom controls) don't dimiss the menu. 221 // (zoom controls) don't dimiss the menu.
221 bool uma_action_recorded_; 222 bool uma_action_recorded_;
222 223
223 // Models for the special menu items with buttons. 224 // Models for the special menu items with buttons.
224 scoped_ptr<ui::ButtonMenuItemModel> edit_menu_item_model_; 225 std::unique_ptr<ui::ButtonMenuItemModel> edit_menu_item_model_;
225 scoped_ptr<ui::ButtonMenuItemModel> zoom_menu_item_model_; 226 std::unique_ptr<ui::ButtonMenuItemModel> zoom_menu_item_model_;
226 227
227 // Label of the zoom label in the zoom menu item. 228 // Label of the zoom label in the zoom menu item.
228 base::string16 zoom_label_; 229 base::string16 zoom_label_;
229 230
230 #if defined(GOOGLE_CHROME_BUILD) 231 #if defined(GOOGLE_CHROME_BUILD)
231 // Help menu. 232 // Help menu.
232 scoped_ptr<HelpMenuModel> help_menu_model_; 233 std::unique_ptr<HelpMenuModel> help_menu_model_;
233 #endif 234 #endif
234 235
235 // Tools menu. 236 // Tools menu.
236 scoped_ptr<ToolsMenuModel> tools_menu_model_; 237 std::unique_ptr<ToolsMenuModel> tools_menu_model_;
237 238
238 // Bookmark submenu. 239 // Bookmark submenu.
239 scoped_ptr<BookmarkSubMenuModel> bookmark_sub_menu_model_; 240 std::unique_ptr<BookmarkSubMenuModel> bookmark_sub_menu_model_;
240 241
241 // Recent Tabs submenu. 242 // Recent Tabs submenu.
242 scoped_ptr<RecentTabsSubMenuModel> recent_tabs_sub_menu_model_; 243 std::unique_ptr<RecentTabsSubMenuModel> recent_tabs_sub_menu_model_;
243 244
244 ui::AcceleratorProvider* provider_; // weak 245 ui::AcceleratorProvider* provider_; // weak
245 246
246 Browser* browser_; // weak 247 Browser* browser_; // weak
247 248
248 scoped_ptr<content::HostZoomMap::Subscription> browser_zoom_subscription_; 249 std::unique_ptr<content::HostZoomMap::Subscription>
250 browser_zoom_subscription_;
249 content::NotificationRegistrar registrar_; 251 content::NotificationRegistrar registrar_;
250 252
251 DISALLOW_COPY_AND_ASSIGN(AppMenuModel); 253 DISALLOW_COPY_AND_ASSIGN(AppMenuModel);
252 }; 254 };
253 255
254 #endif // CHROME_BROWSER_UI_TOOLBAR_APP_MENU_MODEL_H_ 256 #endif // CHROME_BROWSER_UI_TOOLBAR_APP_MENU_MODEL_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/toolbar/app_menu_icon_painter.h ('k') | chrome/browser/ui/toolbar/app_menu_model_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698