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

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

Issue 1505403003: Remove const declaration of POD locals in actions bar code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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
« no previous file with comments | « no previous file | chrome/browser/ui/views/toolbar/browser_actions_container.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "chrome/browser/ui/toolbar/toolbar_actions_bar.h" 5 #include "chrome/browser/ui/toolbar/toolbar_actions_bar.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/profiler/scoped_tracker.h" 9 #include "base/profiler/scoped_tracker.h"
10 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 return 2 * platform_settings_.item_spacing + delegate_->GetChevronWidth(); 186 return 2 * platform_settings_.item_spacing + delegate_->GetChevronWidth();
187 } 187 }
188 188
189 int ToolbarActionsBar::GetMaximumWidth() const { 189 int ToolbarActionsBar::GetMaximumWidth() const {
190 return IconCountToWidth(-1); 190 return IconCountToWidth(-1);
191 } 191 }
192 192
193 int ToolbarActionsBar::IconCountToWidth(int icons) const { 193 int ToolbarActionsBar::IconCountToWidth(int icons) const {
194 if (icons < 0) 194 if (icons < 0)
195 icons = toolbar_actions_.size(); 195 icons = toolbar_actions_.size();
196 const bool display_chevron = 196 bool display_chevron =
197 platform_settings_.chevron_enabled && 197 platform_settings_.chevron_enabled &&
198 static_cast<size_t>(icons) < toolbar_actions_.size(); 198 static_cast<size_t>(icons) < toolbar_actions_.size();
199 if (icons == 0 && !display_chevron) 199 if (icons == 0 && !display_chevron)
200 return platform_settings_.item_spacing; 200 return platform_settings_.item_spacing;
201 201
202 const int icons_size = (icons == 0) ? 0 : 202 int icons_size = (icons == 0) ? 0 :
203 (icons * IconWidth(true)) - platform_settings_.item_spacing; 203 (icons * IconWidth(true)) - platform_settings_.item_spacing;
204 const int chevron_size = display_chevron ? delegate_->GetChevronWidth() : 0; 204 int chevron_size = display_chevron ? delegate_->GetChevronWidth() : 0;
205 const int side_padding = platform_settings_.item_spacing * 2; 205 int side_padding = platform_settings_.item_spacing * 2;
206 206
207 return icons_size + chevron_size + side_padding; 207 return icons_size + chevron_size + side_padding;
208 } 208 }
209 209
210 size_t ToolbarActionsBar::WidthToIconCount(int pixels) const { 210 size_t ToolbarActionsBar::WidthToIconCount(int pixels) const {
211 // Check for widths large enough to show the entire icon set. 211 // Check for widths large enough to show the entire icon set.
212 if (pixels >= IconCountToWidth(-1)) 212 if (pixels >= IconCountToWidth(-1))
213 return toolbar_actions_.size(); 213 return toolbar_actions_.size();
214 214
215 // We reserve space for the padding on either side of the toolbar and, 215 // We reserve space for the padding on either side of the toolbar and,
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after
774 for (ToolbarActionViewController* action : toolbar_actions_) { 774 for (ToolbarActionViewController* action : toolbar_actions_) {
775 if (action->GetId() == action_id) 775 if (action->GetId() == action_id)
776 return action; 776 return action;
777 } 777 }
778 return nullptr; 778 return nullptr;
779 } 779 }
780 780
781 content::WebContents* ToolbarActionsBar::GetCurrentWebContents() { 781 content::WebContents* ToolbarActionsBar::GetCurrentWebContents() {
782 return browser_->tab_strip_model()->GetActiveWebContents(); 782 return browser_->tab_strip_model()->GetActiveWebContents();
783 } 783 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/views/toolbar/browser_actions_container.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698