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

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: 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();
(...skipping 16 matching lines...) Expand all
168 OVERRIDE; 163 OVERRIDE;
169 virtual views::View* GetReferenceViewForPopup() OVERRIDE; 164 virtual views::View* GetReferenceViewForPopup() OVERRIDE;
170 virtual content::WebContents* GetCurrentWebContents() OVERRIDE; 165 virtual content::WebContents* GetCurrentWebContents() OVERRIDE;
171 virtual void HideActivePopup() OVERRIDE; 166 virtual void HideActivePopup() OVERRIDE;
172 virtual void OnIconUpdated() OVERRIDE; 167 virtual void OnIconUpdated() OVERRIDE;
173 virtual void OnPopupShown(bool grant_tab_permissions) OVERRIDE; 168 virtual void OnPopupShown(bool grant_tab_permissions) OVERRIDE;
174 virtual void CleanupPopup() OVERRIDE; 169 virtual void CleanupPopup() OVERRIDE;
175 virtual void OnWillShowContextMenus() OVERRIDE; 170 virtual void OnWillShowContextMenus() OVERRIDE;
176 virtual void OnContextMenuDone() OVERRIDE; 171 virtual void OnContextMenuDone() OVERRIDE;
177 172
173 // Sets whether or not a menu (context menu or extension popup) is visible,
174 // and updates the button state to match.
175 void SetMenuVisible(bool menu_visible);
176
178 // The controller for this ExtensionAction view. 177 // The controller for this ExtensionAction view.
179 scoped_ptr<ExtensionActionViewController> view_controller_; 178 scoped_ptr<ExtensionActionViewController> view_controller_;
180 179
181 // Delegate that usually represents a container for BrowserActionView. 180 // Delegate that usually represents a container for BrowserActionView.
182 BrowserActionView::Delegate* delegate_; 181 BrowserActionView::Delegate* delegate_;
183 182
184 // Used to make sure we only register the command once. 183 // Used to make sure we only register the command once.
185 bool called_registered_extension_command_; 184 bool called_registered_extension_command_;
186 185
187 content::NotificationRegistrar registrar_; 186 content::NotificationRegistrar registrar_;
188 187
189 // The observer that we need to notify when the icon of the button has been 188 // The observer that we need to notify when the icon of the button has been
190 // updated. 189 // updated.
191 IconObserver* icon_observer_; 190 IconObserver* icon_observer_;
192 191
193 DISALLOW_COPY_AND_ASSIGN(BrowserActionView); 192 DISALLOW_COPY_AND_ASSIGN(BrowserActionView);
194 }; 193 };
195 194
196 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_BROWSER_ACTION_VIEW_H_ 195 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_BROWSER_ACTION_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698