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

Unified Diff: chrome/browser/ui/toolbar/toolbar_actions_model.h

Issue 1330423003: [Extensions Toolbar] Protect against crazy bounds (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Final nits 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/toolbar/toolbar_actions_model.h
diff --git a/chrome/browser/ui/toolbar/toolbar_actions_model.h b/chrome/browser/ui/toolbar/toolbar_actions_model.h
index af7b0bd16cdbb336a5db199a9c59e5c0cadf6d93..a92068cfb4e12f78d5a67b5d6baf08c707fc133d 100644
--- a/chrome/browser/ui/toolbar/toolbar_actions_model.h
+++ b/chrome/browser/ui/toolbar/toolbar_actions_model.h
@@ -28,7 +28,13 @@ class ExtensionRegistry;
class ExtensionSet;
}
-// Model for the browser actions toolbar.
+// Model for the browser actions toolbar. This is a per-profile instance, and
+// manages the user's global preferences.
+// Each browser window will attempt to show browser actions as specified by this
+// model, but if the window is too narrow, actions may end up pushed into the
+// overflow menu on a per-window basis. Callers interested in the arrangement of
+// actions in a particular window should check that window's instance of
+// ToolbarActionsBar, which is responsible for the per-window layout.
class ToolbarActionsModel : public extensions::ExtensionActionAPI::Observer,
public extensions::ExtensionRegistryObserver,
public KeyedService {
@@ -123,6 +129,9 @@ class ToolbarActionsModel : public extensions::ExtensionActionAPI::Observer,
// "show all actions".
void SetVisibleIconCount(size_t count);
+ // Note that this (and all_icons_visible()) are the global default, but are
+ // inappropriate for determining a specific window's state - for that, use
+ // the ToolbarActionsBar.
size_t visible_icon_count() const {
// We have guards around this because |visible_icon_count_| can be set by
// prefs/sync, and we want to ensure that the icon count returned is within
@@ -132,7 +141,6 @@ class ToolbarActionsModel : public extensions::ExtensionActionAPI::Observer,
: std::min(static_cast<size_t>(visible_icon_count_),
toolbar_items().size());
}
-
bool all_icons_visible() const {
return visible_icon_count() == toolbar_items().size();
}
« no previous file with comments | « chrome/browser/ui/toolbar/toolbar_actions_bar_unittest.cc ('k') | chrome/browser/ui/toolbar/wrench_menu_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698