OLD | NEW |
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_ACTIONS_CONTAINER_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_TOOLBAR_BROWSER_ACTIONS_CONTAINER_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_TOOLBAR_BROWSER_ACTIONS_CONTAINER_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_TOOLBAR_BROWSER_ACTIONS_CONTAINER_H_ |
7 | 7 |
8 #include "base/observer_list.h" | 8 #include "base/observer_list.h" |
9 #include "chrome/browser/extensions/extension_keybinding_registry.h" | 9 #include "chrome/browser/extensions/extension_keybinding_registry.h" |
10 #include "chrome/browser/extensions/extension_toolbar_model.h" | 10 #include "chrome/browser/extensions/extension_toolbar_model.h" |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 | 196 |
197 // Notify the browser action container that an extension has been moved to | 197 // Notify the browser action container that an extension has been moved to |
198 // the overflow container. | 198 // the overflow container. |
199 void NotifyActionMovedToOverflow(); | 199 void NotifyActionMovedToOverflow(); |
200 | 200 |
201 // Add or remove an observer. | 201 // Add or remove an observer. |
202 void AddObserver(BrowserActionsContainerObserver* observer); | 202 void AddObserver(BrowserActionsContainerObserver* observer); |
203 void RemoveObserver(BrowserActionsContainerObserver* observer); | 203 void RemoveObserver(BrowserActionsContainerObserver* observer); |
204 | 204 |
205 // Overridden from views::View: | 205 // Overridden from views::View: |
206 virtual gfx::Size GetPreferredSize() const OVERRIDE; | 206 virtual gfx::Size GetPreferredSize() const override; |
207 virtual int GetHeightForWidth(int width) const OVERRIDE; | 207 virtual int GetHeightForWidth(int width) const override; |
208 virtual gfx::Size GetMinimumSize() const OVERRIDE; | 208 virtual gfx::Size GetMinimumSize() const override; |
209 virtual void Layout() OVERRIDE; | 209 virtual void Layout() override; |
210 virtual bool GetDropFormats(int* formats, | 210 virtual bool GetDropFormats(int* formats, |
211 std::set<ui::OSExchangeData::CustomFormat>* custom_formats) OVERRIDE; | 211 std::set<ui::OSExchangeData::CustomFormat>* custom_formats) override; |
212 virtual bool AreDropTypesRequired() OVERRIDE; | 212 virtual bool AreDropTypesRequired() override; |
213 virtual bool CanDrop(const ui::OSExchangeData& data) OVERRIDE; | 213 virtual bool CanDrop(const ui::OSExchangeData& data) override; |
214 virtual int OnDragUpdated(const ui::DropTargetEvent& event) OVERRIDE; | 214 virtual int OnDragUpdated(const ui::DropTargetEvent& event) override; |
215 virtual void OnDragExited() OVERRIDE; | 215 virtual void OnDragExited() override; |
216 virtual int OnPerformDrop(const ui::DropTargetEvent& event) OVERRIDE; | 216 virtual int OnPerformDrop(const ui::DropTargetEvent& event) override; |
217 virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE; | 217 virtual void GetAccessibleState(ui::AXViewState* state) override; |
218 | 218 |
219 // Overridden from views::DragController: | 219 // Overridden from views::DragController: |
220 virtual void WriteDragDataForView(View* sender, | 220 virtual void WriteDragDataForView(View* sender, |
221 const gfx::Point& press_pt, | 221 const gfx::Point& press_pt, |
222 ui::OSExchangeData* data) OVERRIDE; | 222 ui::OSExchangeData* data) override; |
223 virtual int GetDragOperationsForView(View* sender, | 223 virtual int GetDragOperationsForView(View* sender, |
224 const gfx::Point& p) OVERRIDE; | 224 const gfx::Point& p) override; |
225 virtual bool CanStartDragForView(View* sender, | 225 virtual bool CanStartDragForView(View* sender, |
226 const gfx::Point& press_pt, | 226 const gfx::Point& press_pt, |
227 const gfx::Point& p) OVERRIDE; | 227 const gfx::Point& p) override; |
228 | 228 |
229 // Overridden from views::ResizeAreaDelegate: | 229 // Overridden from views::ResizeAreaDelegate: |
230 virtual void OnResize(int resize_amount, bool done_resizing) OVERRIDE; | 230 virtual void OnResize(int resize_amount, bool done_resizing) override; |
231 | 231 |
232 // Overridden from gfx::AnimationDelegate: | 232 // Overridden from gfx::AnimationDelegate: |
233 virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE; | 233 virtual void AnimationProgressed(const gfx::Animation* animation) override; |
234 virtual void AnimationEnded(const gfx::Animation* animation) OVERRIDE; | 234 virtual void AnimationEnded(const gfx::Animation* animation) override; |
235 | 235 |
236 // Overridden from BrowserActionView::Delegate: | 236 // Overridden from BrowserActionView::Delegate: |
237 virtual content::WebContents* GetCurrentWebContents() OVERRIDE; | 237 virtual content::WebContents* GetCurrentWebContents() override; |
238 virtual bool ShownInsideMenu() const OVERRIDE; | 238 virtual bool ShownInsideMenu() const override; |
239 virtual void OnBrowserActionViewDragDone() OVERRIDE; | 239 virtual void OnBrowserActionViewDragDone() override; |
240 virtual views::MenuButton* GetOverflowReferenceView() OVERRIDE; | 240 virtual views::MenuButton* GetOverflowReferenceView() override; |
241 virtual void SetPopupOwner(BrowserActionView* popup_owner) OVERRIDE; | 241 virtual void SetPopupOwner(BrowserActionView* popup_owner) override; |
242 virtual void HideActivePopup() OVERRIDE; | 242 virtual void HideActivePopup() override; |
243 virtual BrowserActionView* GetMainViewForExtension( | 243 virtual BrowserActionView* GetMainViewForExtension( |
244 const extensions::Extension* extension) OVERRIDE; | 244 const extensions::Extension* extension) override; |
245 | 245 |
246 // Overridden from extension::ExtensionKeybindingRegistry::Delegate: | 246 // Overridden from extension::ExtensionKeybindingRegistry::Delegate: |
247 virtual extensions::ActiveTabPermissionGranter* | 247 virtual extensions::ActiveTabPermissionGranter* |
248 GetActiveTabPermissionGranter() OVERRIDE; | 248 GetActiveTabPermissionGranter() override; |
249 | 249 |
250 // Retrieve the current popup. This should only be used by unit tests. | 250 // Retrieve the current popup. This should only be used by unit tests. |
251 ExtensionPopup* TestGetPopup(); | 251 ExtensionPopup* TestGetPopup(); |
252 | 252 |
253 // Set how many icons the container should show. This should only be used by | 253 // Set how many icons the container should show. This should only be used by |
254 // unit tests. | 254 // unit tests. |
255 void TestSetIconVisibilityCount(size_t icons); | 255 void TestSetIconVisibilityCount(size_t icons); |
256 | 256 |
257 // Returns the width of an icon, optionally with its padding. | 257 // Returns the width of an icon, optionally with its padding. |
258 static int IconWidth(bool include_padding); | 258 static int IconWidth(bool include_padding); |
259 | 259 |
260 // Returns the height of an icon. | 260 // Returns the height of an icon. |
261 static int IconHeight(); | 261 static int IconHeight(); |
262 | 262 |
263 // During testing we can disable animations by setting this flag to true, | 263 // During testing we can disable animations by setting this flag to true, |
264 // so that the bar resizes instantly, instead of having to poll it while it | 264 // so that the bar resizes instantly, instead of having to poll it while it |
265 // animates to open/closed status. | 265 // animates to open/closed status. |
266 static bool disable_animations_during_testing_; | 266 static bool disable_animations_during_testing_; |
267 | 267 |
268 protected: | 268 protected: |
269 // Overridden from views::View: | 269 // Overridden from views::View: |
270 virtual void ViewHierarchyChanged( | 270 virtual void ViewHierarchyChanged( |
271 const ViewHierarchyChangedDetails& details) OVERRIDE; | 271 const ViewHierarchyChangedDetails& details) override; |
272 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; | 272 virtual void OnPaint(gfx::Canvas* canvas) override; |
273 virtual void OnThemeChanged() OVERRIDE; | 273 virtual void OnThemeChanged() override; |
274 | 274 |
275 private: | 275 private: |
276 // A struct representing the position at which an action will be dropped. | 276 // A struct representing the position at which an action will be dropped. |
277 struct DropPosition; | 277 struct DropPosition; |
278 | 278 |
279 typedef std::vector<BrowserActionView*> BrowserActionViews; | 279 typedef std::vector<BrowserActionView*> BrowserActionViews; |
280 | 280 |
281 // extensions::ExtensionToolbarModel::Observer implementation. | 281 // extensions::ExtensionToolbarModel::Observer implementation. |
282 virtual void ToolbarExtensionAdded(const extensions::Extension* extension, | 282 virtual void ToolbarExtensionAdded(const extensions::Extension* extension, |
283 int index) OVERRIDE; | 283 int index) override; |
284 virtual void ToolbarExtensionRemoved( | 284 virtual void ToolbarExtensionRemoved( |
285 const extensions::Extension* extension) OVERRIDE; | 285 const extensions::Extension* extension) override; |
286 virtual void ToolbarExtensionMoved(const extensions::Extension* extension, | 286 virtual void ToolbarExtensionMoved(const extensions::Extension* extension, |
287 int index) OVERRIDE; | 287 int index) override; |
288 virtual void ToolbarExtensionUpdated( | 288 virtual void ToolbarExtensionUpdated( |
289 const extensions::Extension* extension) OVERRIDE; | 289 const extensions::Extension* extension) override; |
290 virtual bool ShowExtensionActionPopup( | 290 virtual bool ShowExtensionActionPopup( |
291 const extensions::Extension* extension, | 291 const extensions::Extension* extension, |
292 bool grant_active_tab) OVERRIDE; | 292 bool grant_active_tab) override; |
293 virtual void ToolbarVisibleCountChanged() OVERRIDE; | 293 virtual void ToolbarVisibleCountChanged() override; |
294 virtual void ToolbarHighlightModeChanged(bool is_highlighting) OVERRIDE; | 294 virtual void ToolbarHighlightModeChanged(bool is_highlighting) override; |
295 virtual Browser* GetBrowser() OVERRIDE; | 295 virtual Browser* GetBrowser() override; |
296 | 296 |
297 void LoadImages(); | 297 void LoadImages(); |
298 | 298 |
299 // Called when a browser action's visibility may have changed. | 299 // Called when a browser action's visibility may have changed. |
300 void OnBrowserActionVisibilityChanged(); | 300 void OnBrowserActionVisibilityChanged(); |
301 | 301 |
302 // Returns the preferred width of the container in order to show all icons | 302 // Returns the preferred width of the container in order to show all icons |
303 // that should be visible and, optionally, the chevron. | 303 // that should be visible and, optionally, the chevron. |
304 int GetPreferredWidth(); | 304 int GetPreferredWidth(); |
305 | 305 |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 ObserverList<BrowserActionsContainerObserver> observers_; | 409 ObserverList<BrowserActionsContainerObserver> observers_; |
410 | 410 |
411 // The maximum number of icons to show per row when in overflow mode (showing | 411 // The maximum number of icons to show per row when in overflow mode (showing |
412 // icons in the application menu). | 412 // icons in the application menu). |
413 static int icons_per_overflow_menu_row_; | 413 static int icons_per_overflow_menu_row_; |
414 | 414 |
415 DISALLOW_COPY_AND_ASSIGN(BrowserActionsContainer); | 415 DISALLOW_COPY_AND_ASSIGN(BrowserActionsContainer); |
416 }; | 416 }; |
417 | 417 |
418 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_BROWSER_ACTIONS_CONTAINER_H_ | 418 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_BROWSER_ACTIONS_CONTAINER_H_ |
OLD | NEW |