Chromium Code Reviews| Index: chrome/browser/ui/toolbar/toolbar_actions_bar.cc |
| diff --git a/chrome/browser/ui/toolbar/toolbar_actions_bar.cc b/chrome/browser/ui/toolbar/toolbar_actions_bar.cc |
| index 4760d0b7903c6dbe1887bb26b198c55157dded11..cd3347a0ad6913887434e2c150e7ff023ede8dcf 100644 |
| --- a/chrome/browser/ui/toolbar/toolbar_actions_bar.cc |
| +++ b/chrome/browser/ui/toolbar/toolbar_actions_bar.cc |
| @@ -264,9 +264,24 @@ size_t ToolbarActionsBar::GetIconCount() const { |
| return visible_icons; |
| } |
| -gfx::Rect ToolbarActionsBar::GetFrameForIndex(size_t index) const { |
| - size_t start_index = in_overflow_mode() ? |
| - toolbar_actions_.size() - GetIconCount() : 0u; |
| +size_t ToolbarActionsBar::GetStartIndexInBounds() const { |
| + return in_overflow_mode() ? |
| + main_bar_->GetEndIndexInBounds() : 0u; |
|
Peter Kasting
2015/09/15 00:13:38
Nit: Don't add 'u' here unless the code won't comp
Devlin
2015/09/15 18:22:39
Done.
|
| +} |
| + |
| +size_t ToolbarActionsBar::GetEndIndexInBounds() const { |
| + return in_overflow_mode() ? |
| + toolbar_actions_.size() : WidthToIconCount(delegate_->GetWidth()); |
| +} |
| + |
| +bool ToolbarActionsBar::NeedsOverflow() const { |
| + DCHECK(!in_overflow_mode()); |
| + return GetEndIndexInBounds() != toolbar_actions_.size(); |
| +} |
| + |
| +gfx::Rect ToolbarActionsBar::GetFrameForIndex( |
| + size_t index) const { |
| + size_t start_index = GetStartIndexInBounds(); |
| // If the index is for an action that is before range we show (i.e., is for |
| // a button that's on the main bar, and this is the overflow), send back an |