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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 // Executes |command| registered by |extension|. | 166 // Executes |command| registered by |extension|. |
167 void ExecuteExtensionCommand(const extensions::Extension* extension, | 167 void ExecuteExtensionCommand(const extensions::Extension* extension, |
168 const extensions::Command& command); | 168 const extensions::Command& command); |
169 | 169 |
170 // Add or remove an observer. | 170 // Add or remove an observer. |
171 void AddObserver(BrowserActionsContainerObserver* observer); | 171 void AddObserver(BrowserActionsContainerObserver* observer); |
172 void RemoveObserver(BrowserActionsContainerObserver* observer); | 172 void RemoveObserver(BrowserActionsContainerObserver* observer); |
173 | 173 |
174 // Overridden from views::View: | 174 // Overridden from views::View: |
175 virtual gfx::Size GetPreferredSize() OVERRIDE; | 175 virtual gfx::Size GetPreferredSize() OVERRIDE; |
| 176 virtual gfx::Size GetMinimumSize() OVERRIDE; |
176 virtual void Layout() OVERRIDE; | 177 virtual void Layout() OVERRIDE; |
177 virtual bool GetDropFormats(int* formats, | 178 virtual bool GetDropFormats(int* formats, |
178 std::set<ui::OSExchangeData::CustomFormat>* custom_formats) OVERRIDE; | 179 std::set<ui::OSExchangeData::CustomFormat>* custom_formats) OVERRIDE; |
179 virtual bool AreDropTypesRequired() OVERRIDE; | 180 virtual bool AreDropTypesRequired() OVERRIDE; |
180 virtual bool CanDrop(const ui::OSExchangeData& data) OVERRIDE; | 181 virtual bool CanDrop(const ui::OSExchangeData& data) OVERRIDE; |
181 virtual void OnDragEntered(const ui::DropTargetEvent& event) OVERRIDE; | 182 virtual void OnDragEntered(const ui::DropTargetEvent& event) OVERRIDE; |
182 virtual int OnDragUpdated(const ui::DropTargetEvent& event) OVERRIDE; | 183 virtual int OnDragUpdated(const ui::DropTargetEvent& event) OVERRIDE; |
183 virtual void OnDragExited() OVERRIDE; | 184 virtual void OnDragExited() OVERRIDE; |
184 virtual int OnPerformDrop(const ui::DropTargetEvent& event) OVERRIDE; | 185 virtual int OnPerformDrop(const ui::DropTargetEvent& event) OVERRIDE; |
185 virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE; | 186 virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE; |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 | 311 |
311 // Given a pixel width, returns the number of icons that fit. (This | 312 // Given a pixel width, returns the number of icons that fit. (This |
312 // automatically determines whether a chevron will be needed and includes it | 313 // automatically determines whether a chevron will be needed and includes it |
313 // in the calculation.) | 314 // in the calculation.) |
314 size_t WidthToIconCount(int pixels) const; | 315 size_t WidthToIconCount(int pixels) const; |
315 | 316 |
316 // Returns the absolute minimum size you can shrink the container down to and | 317 // Returns the absolute minimum size you can shrink the container down to and |
317 // still show it. This assumes a visible chevron because the only way we | 318 // still show it. This assumes a visible chevron because the only way we |
318 // would not have a chevron when shrinking down this far is if there were no | 319 // would not have a chevron when shrinking down this far is if there were no |
319 // icons, in which case the container wouldn't be shown at all. | 320 // icons, in which case the container wouldn't be shown at all. |
320 int ContainerMinSize() const; | 321 int MinimumNonemptyWidth() const; |
321 | 322 |
322 // Animate to the target size (unless testing, in which case we go straight to | 323 // Animate to the target size (unless testing, in which case we go straight to |
323 // the target size). This also saves the target number of visible icons in | 324 // the target size). This also saves the target number of visible icons in |
324 // the pref if we're not incognito. | 325 // the pref if we're not incognito. |
325 void SaveDesiredSizeAndAnimate(gfx::Tween::Type type, | 326 void SaveDesiredSizeAndAnimate(gfx::Tween::Type type, |
326 size_t num_visible_icons); | 327 size_t num_visible_icons); |
327 | 328 |
328 // Returns true if this extension should be shown in this toolbar. This can | 329 // Returns true if this extension should be shown in this toolbar. This can |
329 // return false if we are in an incognito window and the extension is disabled | 330 // return false if we are in an incognito window and the extension is disabled |
330 // for incognito. | 331 // for incognito. |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 | 403 |
403 // Handles delayed showing of the overflow menu when hovering. | 404 // Handles delayed showing of the overflow menu when hovering. |
404 base::WeakPtrFactory<BrowserActionsContainer> show_menu_task_factory_; | 405 base::WeakPtrFactory<BrowserActionsContainer> show_menu_task_factory_; |
405 | 406 |
406 ObserverList<BrowserActionsContainerObserver> observers_; | 407 ObserverList<BrowserActionsContainerObserver> observers_; |
407 | 408 |
408 DISALLOW_COPY_AND_ASSIGN(BrowserActionsContainer); | 409 DISALLOW_COPY_AND_ASSIGN(BrowserActionsContainer); |
409 }; | 410 }; |
410 | 411 |
411 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_BROWSER_ACTIONS_CONTAINER_H_ | 412 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_BROWSER_ACTIONS_CONTAINER_H_ |
OLD | NEW |