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

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

Issue 547303003: Keep reference view pressed while extension actions have a popup (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: VIEWS_EXPORT fix Created 6 years, 3 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 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_BROWSER_ACTION_VIEW_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_TOOLBAR_BROWSER_ACTION_VIEW_H_
6 #define CHROME_BROWSER_UI_VIEWS_TOOLBAR_BROWSER_ACTION_VIEW_H_ 6 #define CHROME_BROWSER_UI_VIEWS_TOOLBAR_BROWSER_ACTION_VIEW_H_
7 7
8 #include "chrome/browser/ui/views/extensions/extension_action_view_controller.h" 8 #include "chrome/browser/ui/views/extensions/extension_action_view_controller.h"
9 #include "chrome/browser/ui/views/extensions/extension_action_view_delegate.h" 9 #include "chrome/browser/ui/views/extensions/extension_action_view_delegate.h"
10 #include "content/public/browser/notification_observer.h" 10 #include "content/public/browser/notification_observer.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 virtual bool ShownInsideMenu() const = 0; 49 virtual bool ShownInsideMenu() const = 0;
50 50
51 // Notifies that a drag completed. Note this will only happen if the view 51 // Notifies that a drag completed. Note this will only happen if the view
52 // wasn't removed during the drag-and-drop process (i.e., not when there 52 // wasn't removed during the drag-and-drop process (i.e., not when there
53 // was a move in the browser actions, since we re-create the views each 53 // was a move in the browser actions, since we re-create the views each
54 // time we re-order the browser actions). 54 // time we re-order the browser actions).
55 virtual void OnBrowserActionViewDragDone() = 0; 55 virtual void OnBrowserActionViewDragDone() = 0;
56 56
57 // Returns the view of the browser actions overflow menu to use as a 57 // Returns the view of the browser actions overflow menu to use as a
58 // reference point for a popup when this view isn't visible. 58 // reference point for a popup when this view isn't visible.
59 virtual views::View* GetOverflowReferenceView() = 0; 59 virtual views::MenuButton* GetOverflowReferenceView() = 0;
60 60
61 // Sets the delegate's active popup owner to be |popup_owner|. 61 // Sets the delegate's active popup owner to be |popup_owner|.
62 virtual void SetPopupOwner(BrowserActionView* popup_owner) = 0; 62 virtual void SetPopupOwner(BrowserActionView* popup_owner) = 0;
63 63
64 // Hides the active popup of the delegate, if one exists. 64 // Hides the active popup of the delegate, if one exists.
65 virtual void HideActivePopup() = 0; 65 virtual void HideActivePopup() = 0;
66 66
67 // Returns the primary BrowserActionView associated with the given 67 // Returns the primary BrowserActionView associated with the given
68 // |extension|. 68 // |extension|.
69 virtual BrowserActionView* GetMainViewForExtension( 69 virtual BrowserActionView* GetMainViewForExtension(
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 // case) is dismissed. 127 // case) is dismissed.
128 virtual bool Activate() OVERRIDE; 128 virtual bool Activate() OVERRIDE;
129 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; 129 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE;
130 virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE; 130 virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE;
131 virtual void OnMouseExited(const ui::MouseEvent& event) OVERRIDE; 131 virtual void OnMouseExited(const ui::MouseEvent& event) OVERRIDE;
132 virtual bool OnKeyReleased(const ui::KeyEvent& event) OVERRIDE; 132 virtual bool OnKeyReleased(const ui::KeyEvent& event) OVERRIDE;
133 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; 133 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE;
134 virtual scoped_ptr<views::LabelButtonBorder> CreateDefaultBorder() const 134 virtual scoped_ptr<views::LabelButtonBorder> CreateDefaultBorder() const
135 OVERRIDE; 135 OVERRIDE;
136 136
137 // Notifications when to set button state to pushed/not pushed (for when the
138 // popup/context menu is hidden or shown by the container).
139 void SetButtonPushed();
140 void SetButtonNotPushed();
141
142 // Whether the browser action is enabled on this tab. Note that we cannot use 137 // Whether the browser action is enabled on this tab. Note that we cannot use
143 // the built-in views enabled/SetEnabled because disabled views do not 138 // the built-in views enabled/SetEnabled because disabled views do not
144 // receive drag events. 139 // receive drag events.
145 bool IsEnabled(int tab_id) const; 140 bool IsEnabled(int tab_id) const;
146 141
147 // Gets the icon of this button and its badge. 142 // Gets the icon of this button and its badge.
148 gfx::ImageSkia GetIconWithBadge(); 143 gfx::ImageSkia GetIconWithBadge();
149 144
150 // Returns button icon so it can be accessed during tests. 145 // Returns button icon so it can be accessed during tests.
151 gfx::ImageSkia GetIconForTest(); 146 gfx::ImageSkia GetIconForTest();
152 147
153 private: 148 private:
154 // Overridden from views::View: 149 // Overridden from views::View:
155 virtual void ViewHierarchyChanged( 150 virtual void ViewHierarchyChanged(
156 const ViewHierarchyChangedDetails& details) OVERRIDE; 151 const ViewHierarchyChangedDetails& details) OVERRIDE;
157 virtual void OnDragDone() OVERRIDE; 152 virtual void OnDragDone() OVERRIDE;
158 virtual gfx::Size GetPreferredSize() const OVERRIDE; 153 virtual gfx::Size GetPreferredSize() const OVERRIDE;
159 virtual void PaintChildren(gfx::Canvas* canvas, 154 virtual void PaintChildren(gfx::Canvas* canvas,
160 const views::CullSet& cull_set) OVERRIDE; 155 const views::CullSet& cull_set) OVERRIDE;
161 156
162 // ExtensionActionViewDelegate: 157 // ExtensionActionViewDelegate:
163 virtual views::View* GetAsView() OVERRIDE; 158 virtual views::View* GetAsView() OVERRIDE;
164 virtual bool IsShownInMenu() OVERRIDE; 159 virtual bool IsShownInMenu() OVERRIDE;
165 virtual views::FocusManager* GetFocusManagerForAccelerator() OVERRIDE; 160 virtual views::FocusManager* GetFocusManagerForAccelerator() OVERRIDE;
166 virtual views::Widget* GetParentForContextMenu() OVERRIDE; 161 virtual views::Widget* GetParentForContextMenu() OVERRIDE;
167 virtual ExtensionActionViewController* GetPreferredPopupViewController() 162 virtual ExtensionActionViewController* GetPreferredPopupViewController()
168 OVERRIDE; 163 OVERRIDE;
169 virtual views::View* GetReferenceViewForPopup() OVERRIDE; 164 virtual views::View* GetReferenceViewForPopup() OVERRIDE;
165 virtual views::MenuButton* GetContextMenuButton() OVERRIDE;
170 virtual content::WebContents* GetCurrentWebContents() OVERRIDE; 166 virtual content::WebContents* GetCurrentWebContents() OVERRIDE;
171 virtual void HideActivePopup() OVERRIDE; 167 virtual void HideActivePopup() OVERRIDE;
172 virtual void OnIconUpdated() OVERRIDE; 168 virtual void OnIconUpdated() OVERRIDE;
173 virtual void OnPopupShown(bool grant_tab_permissions) OVERRIDE; 169 virtual void OnPopupShown(bool grant_tab_permissions) OVERRIDE;
174 virtual void CleanupPopup() OVERRIDE; 170 virtual void CleanupPopup() OVERRIDE;
175 virtual void OnWillShowContextMenus() OVERRIDE;
176 virtual void OnContextMenuDone() OVERRIDE;
177 171
178 // The controller for this ExtensionAction view. 172 // The controller for this ExtensionAction view.
179 scoped_ptr<ExtensionActionViewController> view_controller_; 173 scoped_ptr<ExtensionActionViewController> view_controller_;
180 174
181 // Delegate that usually represents a container for BrowserActionView. 175 // Delegate that usually represents a container for BrowserActionView.
182 BrowserActionView::Delegate* delegate_; 176 BrowserActionView::Delegate* delegate_;
183 177
184 // Used to make sure we only register the command once. 178 // Used to make sure we only register the command once.
185 bool called_registered_extension_command_; 179 bool called_registered_extension_command_;
186 180
187 content::NotificationRegistrar registrar_; 181 content::NotificationRegistrar registrar_;
188 182
189 // The observer that we need to notify when the icon of the button has been 183 // The observer that we need to notify when the icon of the button has been
190 // updated. 184 // updated.
191 IconObserver* icon_observer_; 185 IconObserver* icon_observer_;
192 186
187 // A lock to keep the MenuButton pressed when a menu or popup is visible.
188 scoped_ptr<views::MenuButton::PressedLock> pressed_lock_;
189
193 DISALLOW_COPY_AND_ASSIGN(BrowserActionView); 190 DISALLOW_COPY_AND_ASSIGN(BrowserActionView);
194 }; 191 };
195 192
196 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_BROWSER_ACTION_VIEW_H_ 193 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_BROWSER_ACTION_VIEW_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/location_bar/page_action_image_view.cc ('k') | chrome/browser/ui/views/toolbar/browser_action_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698