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

Side by Side Diff: chrome/browser/ui/views/toolbar/chevron_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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_CHEVRON_MENU_BUTTON_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_TOOLBAR_CHEVRON_MENU_BUTTON_H_
6 #define CHROME_BROWSER_UI_VIEWS_TOOLBAR_CHEVRON_MENU_BUTTON_H_ 6 #define CHROME_BROWSER_UI_VIEWS_TOOLBAR_CHEVRON_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 "ui/views/controls/button/menu_button.h" 12 #include "ui/views/controls/button/menu_button.h"
12 #include "ui/views/controls/button/menu_button_listener.h" 13 #include "ui/views/controls/button/menu_button_listener.h"
13 14
14 class BrowserActionsContainer; 15 class BrowserActionsContainer;
15 16
16 // The MenuButton for the chevron in the extension toolbar, which is also 17 // The MenuButton for the chevron in the extension toolbar, which is also
17 // responsible for showing the legacy (drop-down) overflow menu. 18 // responsible for showing the legacy (drop-down) overflow menu.
18 class ChevronMenuButton : public views::MenuButton, 19 class ChevronMenuButton : public views::MenuButton,
19 public views::MenuButtonListener { 20 public views::MenuButtonListener {
20 public: 21 public:
21 explicit ChevronMenuButton( 22 explicit ChevronMenuButton(
22 BrowserActionsContainer* browser_actions_container); 23 BrowserActionsContainer* browser_actions_container);
23 ~ChevronMenuButton() override; 24 ~ChevronMenuButton() override;
24 25
25 // Closes the overflow menu (and any context menu), if it is open. 26 // Closes the overflow menu (and any context menu), if it is open.
26 void CloseMenu(); 27 void CloseMenu();
27 28
28 private: 29 private:
29 class MenuController; 30 class MenuController;
30 31
31 // views::MenuButton: 32 // views::MenuButton:
32 scoped_ptr<views::LabelButtonBorder> CreateDefaultBorder() const override; 33 std::unique_ptr<views::LabelButtonBorder> CreateDefaultBorder()
34 const override;
33 bool GetDropFormats( 35 bool GetDropFormats(
34 int* formats, 36 int* formats,
35 std::set<ui::Clipboard::FormatType>* format_types) override; 37 std::set<ui::Clipboard::FormatType>* format_types) override;
36 bool AreDropTypesRequired() override; 38 bool AreDropTypesRequired() override;
37 bool CanDrop(const ui::OSExchangeData& data) override; 39 bool CanDrop(const ui::OSExchangeData& data) override;
38 void OnDragEntered(const ui::DropTargetEvent& event) override; 40 void OnDragEntered(const ui::DropTargetEvent& event) override;
39 int OnDragUpdated(const ui::DropTargetEvent& event) override; 41 int OnDragUpdated(const ui::DropTargetEvent& event) override;
40 void OnDragExited() override; 42 void OnDragExited() override;
41 int OnPerformDrop(const ui::DropTargetEvent& event) override; 43 int OnPerformDrop(const ui::DropTargetEvent& event) override;
42 44
43 // views::MenuButtonListener: 45 // views::MenuButtonListener:
44 void OnMenuButtonClicked(views::MenuButton* source, 46 void OnMenuButtonClicked(views::MenuButton* source,
45 const gfx::Point& point, 47 const gfx::Point& point,
46 const ui::Event* event) override; 48 const ui::Event* event) override;
47 49
48 // Shows the overflow menu. 50 // Shows the overflow menu.
49 void ShowOverflowMenu(bool for_drop); 51 void ShowOverflowMenu(bool for_drop);
50 52
51 // Called by the overflow menu when all the work is done. 53 // Called by the overflow menu when all the work is done.
52 void MenuDone(); 54 void MenuDone();
53 55
54 // The owning BrowserActionsContainer. 56 // The owning BrowserActionsContainer.
55 BrowserActionsContainer* browser_actions_container_; 57 BrowserActionsContainer* browser_actions_container_;
56 58
57 // The overflow menu controller. 59 // The overflow menu controller.
58 scoped_ptr<MenuController> menu_controller_; 60 std::unique_ptr<MenuController> menu_controller_;
59 61
60 base::WeakPtrFactory<ChevronMenuButton> weak_factory_; 62 base::WeakPtrFactory<ChevronMenuButton> weak_factory_;
61 63
62 DISALLOW_COPY_AND_ASSIGN(ChevronMenuButton); 64 DISALLOW_COPY_AND_ASSIGN(ChevronMenuButton);
63 }; 65 };
64 66
65 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_CHEVRON_MENU_BUTTON_H_ 67 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_CHEVRON_MENU_BUTTON_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698