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

Side by Side Diff: chrome/browser/ui/views/toolbar/toolbar_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_TOOLBAR_BUTTON_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_BUTTON_H_
6 #define CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_BUTTON_H_ 6 #define CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_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 "ui/gfx/geometry/point.h" 11 #include "ui/gfx/geometry/point.h"
11 #include "ui/views/context_menu_controller.h" 12 #include "ui/views/context_menu_controller.h"
12 #include "ui/views/controls/button/button.h" 13 #include "ui/views/controls/button/button.h"
13 #include "ui/views/controls/button/label_button.h" 14 #include "ui/views/controls/button/label_button.h"
14 15
15 class Profile; 16 class Profile;
16 17
17 namespace ui { 18 namespace ui {
18 class MenuModel; 19 class MenuModel;
19 } 20 }
(...skipping 27 matching lines...) Expand all
47 // views::LabelButton: 48 // views::LabelButton:
48 gfx::Size GetPreferredSize() const override; 49 gfx::Size GetPreferredSize() const override;
49 bool OnMousePressed(const ui::MouseEvent& event) override; 50 bool OnMousePressed(const ui::MouseEvent& event) override;
50 bool OnMouseDragged(const ui::MouseEvent& event) override; 51 bool OnMouseDragged(const ui::MouseEvent& event) override;
51 void OnMouseReleased(const ui::MouseEvent& event) override; 52 void OnMouseReleased(const ui::MouseEvent& event) override;
52 // Showing the drop down results in a MouseCaptureLost, we need to ignore it. 53 // Showing the drop down results in a MouseCaptureLost, we need to ignore it.
53 void OnMouseCaptureLost() override; 54 void OnMouseCaptureLost() override;
54 void OnMouseExited(const ui::MouseEvent& event) override; 55 void OnMouseExited(const ui::MouseEvent& event) override;
55 void OnGestureEvent(ui::GestureEvent* event) override; 56 void OnGestureEvent(ui::GestureEvent* event) override;
56 void GetAccessibleState(ui::AXViewState* state) override; 57 void GetAccessibleState(ui::AXViewState* state) override;
57 scoped_ptr<views::LabelButtonBorder> CreateDefaultBorder() const override; 58 std::unique_ptr<views::LabelButtonBorder> CreateDefaultBorder()
59 const override;
58 60
59 // views::ContextMenuController: 61 // views::ContextMenuController:
60 void ShowContextMenuForView(View* source, 62 void ShowContextMenuForView(View* source,
61 const gfx::Point& point, 63 const gfx::Point& point,
62 ui::MenuSourceType source_type) override; 64 ui::MenuSourceType source_type) override;
63 65
64 protected: 66 protected:
65 // Returns if menu should be shown. Override this to change default behavior. 67 // Returns if menu should be shown. Override this to change default behavior.
66 virtual bool ShouldShowMenu(); 68 virtual bool ShouldShowMenu();
67 69
68 // Function to show the dropdown menu. 70 // Function to show the dropdown menu.
69 virtual void ShowDropDownMenu(ui::MenuSourceType source_type); 71 virtual void ShowDropDownMenu(ui::MenuSourceType source_type);
70 72
71 private: 73 private:
72 // Callback for MenuModelAdapter. 74 // Callback for MenuModelAdapter.
73 void OnMenuClosed(); 75 void OnMenuClosed();
74 76
75 // views::LabelButton: 77 // views::LabelButton:
76 const char* GetClassName() const override; 78 const char* GetClassName() const override;
77 79
78 // The associated profile. The browser theme affects rendering. 80 // The associated profile. The browser theme affects rendering.
79 Profile* profile_; 81 Profile* profile_;
80 82
81 // The model that populates the attached menu. 83 // The model that populates the attached menu.
82 scoped_ptr<ui::MenuModel> model_; 84 std::unique_ptr<ui::MenuModel> model_;
83 85
84 // Indicates if menu is currently showing. 86 // Indicates if menu is currently showing.
85 bool menu_showing_; 87 bool menu_showing_;
86 88
87 // Y position of mouse when left mouse button is pressed. 89 // Y position of mouse when left mouse button is pressed.
88 int y_position_on_lbuttondown_; 90 int y_position_on_lbuttondown_;
89 91
90 // The model adapter for the drop down menu. 92 // The model adapter for the drop down menu.
91 scoped_ptr<views::MenuModelAdapter> menu_model_adapter_; 93 std::unique_ptr<views::MenuModelAdapter> menu_model_adapter_;
92 94
93 // Menu runner to display drop down menu. 95 // Menu runner to display drop down menu.
94 scoped_ptr<views::MenuRunner> menu_runner_; 96 std::unique_ptr<views::MenuRunner> menu_runner_;
95 97
96 // Controls the visual feedback for the button state. 98 // Controls the visual feedback for the button state.
97 scoped_ptr<views::InkDropDelegate> ink_drop_delegate_; 99 std::unique_ptr<views::InkDropDelegate> ink_drop_delegate_;
98 100
99 // A factory for tasks that show the dropdown context menu for the button. 101 // A factory for tasks that show the dropdown context menu for the button.
100 base::WeakPtrFactory<ToolbarButton> show_menu_factory_; 102 base::WeakPtrFactory<ToolbarButton> show_menu_factory_;
101 103
102 DISALLOW_COPY_AND_ASSIGN(ToolbarButton); 104 DISALLOW_COPY_AND_ASSIGN(ToolbarButton);
103 }; 105 };
104 106
105 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_BUTTON_H_ 107 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_BUTTON_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698