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

Side by Side Diff: chrome/browser/ui/views/extensions/browser_action_overflow_menu_controller.h

Issue 7720012: Moves ownership of MenuItemView to MenuRunner as well as responbility (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix unit test Created 9 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) 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 CHROME_BROWSER_UI_VIEWS_EXTENSIONS_BROWSER_ACTION_OVERFLOW_MENU_CONTROLL ER_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_EXTENSIONS_BROWSER_ACTION_OVERFLOW_MENU_CONTROLL ER_H_
6 #define CHROME_BROWSER_UI_VIEWS_EXTENSIONS_BROWSER_ACTION_OVERFLOW_MENU_CONTROLL ER_H_ 6 #define CHROME_BROWSER_UI_VIEWS_EXTENSIONS_BROWSER_ACTION_OVERFLOW_MENU_CONTROLL ER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <set> 9 #include <set>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/task.h" 13 #include "base/task.h"
14 #include "views/controls/menu/menu_delegate.h" 14 #include "views/controls/menu/menu_delegate.h"
15 15
16 class BrowserActionsContainer; 16 class BrowserActionsContainer;
17 class BrowserActionView; 17 class BrowserActionView;
18 18
19 namespace views { 19 namespace views {
20 class MenuRunner;
20 class Widget; 21 class Widget;
21 } 22 }
22 23
23 // This class handles the overflow menu for browser actions (showing the menu, 24 // This class handles the overflow menu for browser actions (showing the menu,
24 // drag and drop, etc). This class manages its own lifetime. 25 // drag and drop, etc). This class manages its own lifetime.
25 class BrowserActionOverflowMenuController : public views::MenuDelegate { 26 class BrowserActionOverflowMenuController : public views::MenuDelegate {
26 public: 27 public:
27 // The observer is notified prior to the menu being deleted. 28 // The observer is notified prior to the menu being deleted.
28 class Observer { 29 class Observer {
29 public: 30 public:
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 84
84 // A pointer to the browser action container that owns the overflow menu. 85 // A pointer to the browser action container that owns the overflow menu.
85 BrowserActionsContainer* owner_; 86 BrowserActionsContainer* owner_;
86 87
87 // The observer, may be null. 88 // The observer, may be null.
88 Observer* observer_; 89 Observer* observer_;
89 90
90 // A pointer to the overflow menu button that we are showing the menu for. 91 // A pointer to the overflow menu button that we are showing the menu for.
91 views::MenuButton* menu_button_; 92 views::MenuButton* menu_button_;
92 93
93 // The overflow menu for the menu button. 94 // The overflow menu for the menu button. Owned by |menu_runner_|.
94 scoped_ptr<views::MenuItemView> menu_; 95 views::MenuItemView* menu_;
96
97 // Resposible for running the menu.
98 scoped_ptr<views::MenuRunner> menu_runner_;
95 99
96 // The views vector of all the browser actions the container knows about. We 100 // The views vector of all the browser actions the container knows about. We
97 // won't show all items, just the one starting at |start_index| and above. 101 // won't show all items, just the one starting at |start_index| and above.
98 const std::vector<BrowserActionView*>* views_; 102 const std::vector<BrowserActionView*>* views_;
99 103
100 // The index into the BrowserActionView vector, indicating where to start 104 // The index into the BrowserActionView vector, indicating where to start
101 // picking browser actions to draw. 105 // picking browser actions to draw.
102 int start_index_; 106 int start_index_;
103 107
104 // Whether this controller is being used for drop. 108 // Whether this controller is being used for drop.
105 bool for_drop_; 109 bool for_drop_;
106 110
107 friend class DeleteTask<BrowserActionOverflowMenuController>; 111 friend class DeleteTask<BrowserActionOverflowMenuController>;
108 112
109 DISALLOW_COPY_AND_ASSIGN(BrowserActionOverflowMenuController); 113 DISALLOW_COPY_AND_ASSIGN(BrowserActionOverflowMenuController);
110 }; 114 };
111 115
112 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_BROWSER_ACTION_OVERFLOW_MENU_CONTR OLLER_H_ 116 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_BROWSER_ACTION_OVERFLOW_MENU_CONTR OLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698