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

Side by Side Diff: ui/views/controls/menu/menu_controller_delegate.h

Issue 2659903002: Change MenuControllerDelegate to provide WeakPtr (Closed)
Patch Set: Created 3 years, 10 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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_MENU_MENU_CONTROLLER_DELEGATE_H_ 5 #ifndef UI_VIEWS_CONTROLS_MENU_MENU_CONTROLLER_DELEGATE_H_
6 #define UI_VIEWS_CONTROLS_MENU_MENU_CONTROLLER_DELEGATE_H_ 6 #define UI_VIEWS_CONTROLS_MENU_MENU_CONTROLLER_DELEGATE_H_
7 7
8 #include "base/memory/weak_ptr.h"
9
8 namespace views { 10 namespace views {
9 11
10 class MenuItemView; 12 class MenuItemView;
11 13
12 // This is internal as there should be no need for usage of this class outside 14 // This is internal as there should be no need for usage of this class outside
13 // of views. 15 // of views.
14 namespace internal { 16 namespace internal {
15 17
16 // Used by MenuController to notify of interesting events that are intended for 18 // Used by MenuController to notify of interesting events that are intended for
17 // the class using MenuController. This is implemented by MenuRunnerImpl. 19 // the class using MenuController. This is implemented by MenuRunnerImpl.
18 class MenuControllerDelegate { 20 class MenuControllerDelegate
21 : public base::SupportsWeakPtr<MenuControllerDelegate> {
19 public: 22 public:
20 enum NotifyType { 23 enum NotifyType {
21 NOTIFY_DELEGATE, 24 NOTIFY_DELEGATE,
22 DONT_NOTIFY_DELEGATE 25 DONT_NOTIFY_DELEGATE
23 }; 26 };
24 27
25 // Invoked when MenuController closes a menu and the MenuController was 28 // Invoked when MenuController closes a menu and the MenuController was
26 // configured for asynchronous or drop (MenuRunner::ASYNC, 29 // configured for asynchronous or drop (MenuRunner::ASYNC,
27 // MenuRunner::FOR_DROP). |mouse_event_flags| are the flags set on the 30 // MenuRunner::FOR_DROP). |mouse_event_flags| are the flags set on the
28 // ui::MouseEvent which selected |menu|, otherwise 0. 31 // ui::MouseEvent which selected |menu|, otherwise 0.
29 virtual void OnMenuClosed(NotifyType type, 32 virtual void OnMenuClosed(NotifyType type,
30 MenuItemView* menu, 33 MenuItemView* menu,
31 int mouse_event_flags) = 0; 34 int mouse_event_flags) = 0;
32 35
33 // Invoked when the MenuDelegate::GetSiblingMenu() returns non-NULL. 36 // Invoked when the MenuDelegate::GetSiblingMenu() returns non-NULL.
34 virtual void SiblingMenuCreated(MenuItemView* menu) = 0; 37 virtual void SiblingMenuCreated(MenuItemView* menu) = 0;
35 38
36 protected: 39 protected:
37 virtual ~MenuControllerDelegate() {} 40 virtual ~MenuControllerDelegate() {}
38 }; 41 };
39 42
40 } // namespace internal 43 } // namespace internal
41 44
42 } // namespace view 45 } // namespace view
43 46
44 #endif // UI_VIEWS_CONTROLS_MENU_MENU_CONTROLLER_DELEGATE_H_ 47 #endif // UI_VIEWS_CONTROLS_MENU_MENU_CONTROLLER_DELEGATE_H_
OLDNEW
« no previous file with comments | « ui/views/controls/menu/menu_controller.cc ('k') | ui/views/controls/menu/menu_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698