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

Side by Side Diff: ui/views/controls/button/button_dropdown.h

Issue 10832184: Fixed memory leak. Untangled confusing code with menu initialization and ownership. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 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 | Annotate | Revision Log
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 UI_VIEWS_CONTROLS_BUTTON_BUTTON_DROPDOWN_H_ 5 #ifndef UI_VIEWS_CONTROLS_BUTTON_BUTTON_DROPDOWN_H_
6 #define UI_VIEWS_CONTROLS_BUTTON_BUTTON_DROPDOWN_H_ 6 #define UI_VIEWS_CONTROLS_BUTTON_BUTTON_DROPDOWN_H_
7 7
8 #include "base/memory/weak_ptr.h" 8 #include "base/memory/weak_ptr.h"
9 #include "ui/views/controls/button/image_button.h" 9 #include "ui/views/controls/button/image_button.h"
10 10
(...skipping 14 matching lines...) Expand all
25 // 25 //
26 //////////////////////////////////////////////////////////////////////////////// 26 ////////////////////////////////////////////////////////////////////////////////
27 class VIEWS_EXPORT ButtonDropDown : public ImageButton { 27 class VIEWS_EXPORT ButtonDropDown : public ImageButton {
28 public: 28 public:
29 // The button's class name. 29 // The button's class name.
30 static const char kViewClassName[]; 30 static const char kViewClassName[];
31 31
32 ButtonDropDown(ButtonListener* listener, ui::MenuModel* model); 32 ButtonDropDown(ButtonListener* listener, ui::MenuModel* model);
33 virtual ~ButtonDropDown(); 33 virtual ~ButtonDropDown();
34 34
35 void set_menu_model(ui::MenuModel* model) { model_ = model; }
36
35 // If menu is currently pending for long press - stop it. 37 // If menu is currently pending for long press - stop it.
36 void ClearPendingMenu(); 38 void ClearPendingMenu();
37 39
38 // Indicates if menu is currently showing. 40 // Indicates if menu is currently showing.
39 bool IsMenuShowing() const; 41 bool IsMenuShowing() const;
40 42
41 // Overridden from views::View 43 // Overridden from views::View
42 virtual bool OnMousePressed(const MouseEvent& event) OVERRIDE; 44 virtual bool OnMousePressed(const MouseEvent& event) OVERRIDE;
43 virtual bool OnMouseDragged(const MouseEvent& event) OVERRIDE; 45 virtual bool OnMouseDragged(const MouseEvent& event) OVERRIDE;
44 virtual void OnMouseReleased(const MouseEvent& event) OVERRIDE; 46 virtual void OnMouseReleased(const MouseEvent& event) OVERRIDE;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 82
81 // A factory for tasks that show the dropdown context menu for the button. 83 // A factory for tasks that show the dropdown context menu for the button.
82 base::WeakPtrFactory<ButtonDropDown> show_menu_factory_; 84 base::WeakPtrFactory<ButtonDropDown> show_menu_factory_;
83 85
84 DISALLOW_COPY_AND_ASSIGN(ButtonDropDown); 86 DISALLOW_COPY_AND_ASSIGN(ButtonDropDown);
85 }; 87 };
86 88
87 } // namespace views 89 } // namespace views
88 90
89 #endif // UI_VIEWS_CONTROLS_BUTTON_BUTTON_DROPDOWN_H_ 91 #endif // UI_VIEWS_CONTROLS_BUTTON_BUTTON_DROPDOWN_H_
OLDNEW
« chrome/browser/ui/views/reload_button.cc ('K') | « chrome/browser/ui/views/reload_button.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698