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

Side by Side Diff: chrome/browser/ui/views/toolbar/toolbar_button.h

Issue 1864423002: ToolbarButton: Reset menu runner before deleting its menu's delegate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ViewEventTestBase fix 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
« no previous file with comments | « no previous file | chrome/browser/ui/views/toolbar/toolbar_button.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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> 8 #include <memory>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "ui/gfx/geometry/point.h" 11 #include "ui/gfx/geometry/point.h"
12 #include "ui/views/context_menu_controller.h" 12 #include "ui/views/context_menu_controller.h"
13 #include "ui/views/controls/button/button.h" 13 #include "ui/views/controls/button/button.h"
14 #include "ui/views/controls/button/label_button.h" 14 #include "ui/views/controls/button/label_button.h"
15 15
16 class Profile; 16 class Profile;
17 17
18 namespace test {
19 class ToolbarButtonTestApi;
20 }
21
18 namespace ui { 22 namespace ui {
19 class MenuModel; 23 class MenuModel;
20 } 24 }
21 25
22 namespace views { 26 namespace views {
23 class InkDropDelegate; 27 class InkDropDelegate;
24 class MenuModelAdapter; 28 class MenuModelAdapter;
25 class MenuRunner; 29 class MenuRunner;
26 } 30 }
27 31
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 ui::MenuSourceType source_type) override; 68 ui::MenuSourceType source_type) override;
65 69
66 protected: 70 protected:
67 // Returns if menu should be shown. Override this to change default behavior. 71 // Returns if menu should be shown. Override this to change default behavior.
68 virtual bool ShouldShowMenu(); 72 virtual bool ShouldShowMenu();
69 73
70 // Function to show the dropdown menu. 74 // Function to show the dropdown menu.
71 virtual void ShowDropDownMenu(ui::MenuSourceType source_type); 75 virtual void ShowDropDownMenu(ui::MenuSourceType source_type);
72 76
73 private: 77 private:
78 friend test::ToolbarButtonTestApi;
79
74 // Callback for MenuModelAdapter. 80 // Callback for MenuModelAdapter.
75 void OnMenuClosed(); 81 void OnMenuClosed();
76 82
77 // views::LabelButton: 83 // views::LabelButton:
78 const char* GetClassName() const override; 84 const char* GetClassName() const override;
79 85
80 // The associated profile. The browser theme affects rendering. 86 // The associated profile. The browser theme affects rendering.
81 Profile* profile_; 87 Profile* profile_;
82 88
83 // The model that populates the attached menu. 89 // The model that populates the attached menu.
(...skipping 14 matching lines...) Expand all
98 // Controls the visual feedback for the button state. 104 // Controls the visual feedback for the button state.
99 std::unique_ptr<views::InkDropDelegate> ink_drop_delegate_; 105 std::unique_ptr<views::InkDropDelegate> ink_drop_delegate_;
100 106
101 // A factory for tasks that show the dropdown context menu for the button. 107 // A factory for tasks that show the dropdown context menu for the button.
102 base::WeakPtrFactory<ToolbarButton> show_menu_factory_; 108 base::WeakPtrFactory<ToolbarButton> show_menu_factory_;
103 109
104 DISALLOW_COPY_AND_ASSIGN(ToolbarButton); 110 DISALLOW_COPY_AND_ASSIGN(ToolbarButton);
105 }; 111 };
106 112
107 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_BUTTON_H_ 113 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_BUTTON_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/views/toolbar/toolbar_button.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698