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

Side by Side Diff: chrome/browser/ui/views/toolbar/app_menu_button.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 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 #ifndef CHROME_BROWSER_UI_VIEWS_TOOLBAR_APP_MENU_BUTTON_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_TOOLBAR_APP_MENU_BUTTON_H_
6 #define CHROME_BROWSER_UI_VIEWS_TOOLBAR_APP_MENU_BUTTON_H_ 6 #define CHROME_BROWSER_UI_VIEWS_TOOLBAR_APP_MENU_BUTTON_H_
7 7
8 #include <memory>
9
8 #include "base/macros.h" 10 #include "base/macros.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
11 #include "chrome/browser/ui/toolbar/app_menu_icon_painter.h" 12 #include "chrome/browser/ui/toolbar/app_menu_icon_painter.h"
12 #include "ui/views/controls/button/menu_button.h" 13 #include "ui/views/controls/button/menu_button.h"
13 #include "ui/views/controls/button/menu_button_listener.h" 14 #include "ui/views/controls/button/menu_button_listener.h"
14 #include "ui/views/view.h" 15 #include "ui/views/view.h"
15 16
16 class AppMenu; 17 class AppMenu;
17 class AppMenuModel; 18 class AppMenuModel;
18 19
19 namespace views { 20 namespace views {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 // to make the focus rectangle centered. 65 // to make the focus rectangle centered.
65 void SetTrailingMargin(int margin); 66 void SetTrailingMargin(int margin);
66 67
67 // Opens the app menu immediately during a drag-and-drop operation. 68 // Opens the app menu immediately during a drag-and-drop operation.
68 // Used only in testing. 69 // Used only in testing.
69 static bool g_open_app_immediately_for_testing; 70 static bool g_open_app_immediately_for_testing;
70 71
71 private: 72 private:
72 // views::MenuButton: 73 // views::MenuButton:
73 const char* GetClassName() const override; 74 const char* GetClassName() const override;
74 scoped_ptr<views::LabelButtonBorder> CreateDefaultBorder() const override; 75 std::unique_ptr<views::LabelButtonBorder> CreateDefaultBorder()
76 const override;
75 gfx::Rect GetThemePaintRect() const override; 77 gfx::Rect GetThemePaintRect() const override;
76 bool GetDropFormats( 78 bool GetDropFormats(
77 int* formats, 79 int* formats,
78 std::set<ui::Clipboard::FormatType>* format_types) override; 80 std::set<ui::Clipboard::FormatType>* format_types) override;
79 bool AreDropTypesRequired() override; 81 bool AreDropTypesRequired() override;
80 bool CanDrop(const ui::OSExchangeData& data) override; 82 bool CanDrop(const ui::OSExchangeData& data) override;
81 void OnDragEntered(const ui::DropTargetEvent& event) override; 83 void OnDragEntered(const ui::DropTargetEvent& event) override;
82 int OnDragUpdated(const ui::DropTargetEvent& event) override; 84 int OnDragUpdated(const ui::DropTargetEvent& event) override;
83 void OnDragExited() override; 85 void OnDragExited() override;
84 int OnPerformDrop(const ui::DropTargetEvent& event) override; 86 int OnPerformDrop(const ui::DropTargetEvent& event) override;
85 void OnPaint(gfx::Canvas* canvas) override; 87 void OnPaint(gfx::Canvas* canvas) override;
86 88
87 // Only used in pre-MD. 89 // Only used in pre-MD.
88 scoped_ptr<AppMenuIconPainter> icon_painter_; 90 std::unique_ptr<AppMenuIconPainter> icon_painter_;
89 91
90 // Only used in MD. 92 // Only used in MD.
91 AppMenuIconPainter::Severity severity_; 93 AppMenuIconPainter::Severity severity_;
92 94
93 // Our owning toolbar view. 95 // Our owning toolbar view.
94 ToolbarView* toolbar_view_; 96 ToolbarView* toolbar_view_;
95 97
96 // Whether or not we should allow dragging extension icons onto this button 98 // Whether or not we should allow dragging extension icons onto this button
97 // (in order to open the overflow in the app menu). 99 // (in order to open the overflow in the app menu).
98 bool allow_extension_dragging_; 100 bool allow_extension_dragging_;
99 101
100 // Listeners to call when the menu opens. 102 // Listeners to call when the menu opens.
101 base::ObserverList<views::MenuListener> menu_listeners_; 103 base::ObserverList<views::MenuListener> menu_listeners_;
102 104
103 // App model and menu. 105 // App model and menu.
104 // Note that the menu should be destroyed before the model it uses, so the 106 // Note that the menu should be destroyed before the model it uses, so the
105 // menu should be listed later. 107 // menu should be listed later.
106 scoped_ptr<AppMenuModel> menu_model_; 108 std::unique_ptr<AppMenuModel> menu_model_;
107 scoped_ptr<AppMenu> menu_; 109 std::unique_ptr<AppMenu> menu_;
108
109 110
110 // Any trailing margin to be applied. Used when the browser is in 111 // Any trailing margin to be applied. Used when the browser is in
111 // a maximized state to extend to the full window width. 112 // a maximized state to extend to the full window width.
112 int margin_trailing_; 113 int margin_trailing_;
113 114
114 // Controls the visual feedback for the button state. 115 // Controls the visual feedback for the button state.
115 scoped_ptr<views::InkDropDelegate> ink_drop_delegate_; 116 std::unique_ptr<views::InkDropDelegate> ink_drop_delegate_;
116 117
117 // Used to spawn weak pointers for delayed tasks to open the overflow menu. 118 // Used to spawn weak pointers for delayed tasks to open the overflow menu.
118 base::WeakPtrFactory<AppMenuButton> weak_factory_; 119 base::WeakPtrFactory<AppMenuButton> weak_factory_;
119 120
120 DISALLOW_COPY_AND_ASSIGN(AppMenuButton); 121 DISALLOW_COPY_AND_ASSIGN(AppMenuButton);
121 }; 122 };
122 123
123 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_APP_MENU_BUTTON_H_ 124 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_APP_MENU_BUTTON_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/toolbar/app_menu.cc ('k') | chrome/browser/ui/views/toolbar/app_menu_button.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698