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

Side by Side Diff: chrome/browser/ui/toolbar/toolbar_actions_bar.h

Issue 1330423003: [Extensions Toolbar] Protect against crazy bounds (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Peter's Created 5 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_TOOLBAR_TOOLBAR_ACTIONS_BAR_H_ 5 #ifndef CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_ACTIONS_BAR_H_
6 #define CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_ACTIONS_BAR_H_ 6 #define CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_ACTIONS_BAR_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/scoped_vector.h" 10 #include "base/memory/scoped_vector.h"
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 // Returns the [minimum|maximum] possible width for the toolbar. 94 // Returns the [minimum|maximum] possible width for the toolbar.
95 int GetMinimumWidth() const; 95 int GetMinimumWidth() const;
96 int GetMaximumWidth() const; 96 int GetMaximumWidth() const;
97 97
98 // Returns the width for the given number of icons. 98 // Returns the width for the given number of icons.
99 int IconCountToWidth(int icons) const; 99 int IconCountToWidth(int icons) const;
100 100
101 // Returns the number of icons that can fit within the given width. 101 // Returns the number of icons that can fit within the given width.
102 size_t WidthToIconCount(int width) const; 102 size_t WidthToIconCount(int width) const;
103 103
104 // Returns the number of icons that should be displayed. 104 // Returns the number of icons that should be displayed if space allows.
105 size_t GetIconCount() const; 105 size_t GetIconCount() const;
106 106
107 // Returns the starting index (inclusive) for displayable icons.
108 size_t GetStartIndexInBounds() const;
109
110 // Returns the ending index (exclusive) for displayable icons.
111 size_t GetEndIndexInBounds() const;
112
113 // Returns true if an overflow container is necessary to display any other
114 // icons. This is different than ToolbarActionsModel::all_icons_visible()
115 // because the ToolbarActionsBar (which represents the UI for a specific
116 // window) might be unable to display all the icons that the model (which
117 // represents the underlying model of *all* windows) is set to, such as in
Peter Kasting 2015/09/17 00:18:04 So does this mean that if all windows are equally
Devlin 2015/09/17 17:00:27 I've cleared up this comment, and added some bette
Peter Kasting 2015/09/17 19:59:53 Yeah, these help.
118 // the case of a very narrow window.
Peter Kasting 2015/09/17 00:18:04 This comment helps, but it might be necessary to i
Devlin 2015/09/17 17:00:27 See above.
119 bool NeedsOverflow() const;
120
107 // Returns the frame (bounds) that the specified index should have, taking 121 // Returns the frame (bounds) that the specified index should have, taking
108 // into account if this is the main or overflow bar. If this is the overflow 122 // into account if this is the main or overflow bar. If this is the overflow
109 // bar and the index should not be displayed (i.e., it is shown on the main 123 // bar and the index should not be displayed (i.e., it is shown on the main
110 // bar), returns an empty rect. 124 // bar), returns an empty rect.
111 gfx::Rect GetFrameForIndex(size_t index) const; 125 gfx::Rect GetFrameForIndex(size_t index) const;
112 126
113 // Returns the actions in the proper order; this may differ from the 127 // Returns the actions in the proper order; this may differ from the
114 // underlying order in the case of actions being popped out to show a popup. 128 // underlying order in the case of actions being popped out to show a popup.
115 std::vector<ToolbarActionViewController*> GetActions() const; 129 std::vector<ToolbarActionViewController*> GetActions() const;
116 130
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 // The controller of the bubble to show once animation finishes, if any. 301 // The controller of the bubble to show once animation finishes, if any.
288 scoped_ptr<extensions::ExtensionMessageBubbleController> 302 scoped_ptr<extensions::ExtensionMessageBubbleController>
289 pending_extension_bubble_controller_; 303 pending_extension_bubble_controller_;
290 304
291 base::WeakPtrFactory<ToolbarActionsBar> weak_ptr_factory_; 305 base::WeakPtrFactory<ToolbarActionsBar> weak_ptr_factory_;
292 306
293 DISALLOW_COPY_AND_ASSIGN(ToolbarActionsBar); 307 DISALLOW_COPY_AND_ASSIGN(ToolbarActionsBar);
294 }; 308 };
295 309
296 #endif // CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_ACTIONS_BAR_H_ 310 #endif // CHROME_BROWSER_UI_TOOLBAR_TOOLBAR_ACTIONS_BAR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698