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

Side by Side Diff: chrome/browser/ui/views/toolbar/reload_button.cc

Issue 1406613002: For some vector icons, get the size from the vector definition. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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 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 #include "chrome/browser/ui/views/toolbar/reload_button.h" 5 #include "chrome/browser/ui/views/toolbar/reload_button.h"
6 6
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "chrome/app/chrome_command_ids.h" 8 #include "chrome/app/chrome_command_ids.h"
9 #include "chrome/browser/command_updater.h" 9 #include "chrome/browser/command_updater.h"
10 #include "chrome/browser/search/search.h" 10 #include "chrome/browser/search/search.h"
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 } 226 }
227 227
228 void ReloadButton::ChangeModeInternal(Mode mode) { 228 void ReloadButton::ChangeModeInternal(Mode mode) {
229 ui::ThemeProvider* tp = GetThemeProvider(); 229 ui::ThemeProvider* tp = GetThemeProvider();
230 // |tp| can be NULL in unit tests. 230 // |tp| can be NULL in unit tests.
231 if (tp) { 231 if (tp) {
232 if (ui::MaterialDesignController::IsModeMaterial()) { 232 if (ui::MaterialDesignController::IsModeMaterial()) {
233 const gfx::VectorIconId icon_id = (mode == MODE_RELOAD) 233 const gfx::VectorIconId icon_id = (mode == MODE_RELOAD)
234 ? gfx::VectorIconId::NAVIGATE_RELOAD 234 ? gfx::VectorIconId::NAVIGATE_RELOAD
235 : gfx::VectorIconId::NAVIGATE_STOP; 235 : gfx::VectorIconId::NAVIGATE_STOP;
236 const int kButtonSize = 16;
237 const SkColor normal_color = 236 const SkColor normal_color =
238 tp->GetColor(ThemeProperties::COLOR_TOOLBAR_BUTTON_ICON); 237 tp->GetColor(ThemeProperties::COLOR_TOOLBAR_BUTTON_ICON);
239 const SkColor disabled_color = 238 const SkColor disabled_color =
240 tp->GetColor(ThemeProperties::COLOR_TOOLBAR_BUTTON_ICON_INACTIVE); 239 tp->GetColor(ThemeProperties::COLOR_TOOLBAR_BUTTON_ICON_INACTIVE);
241 SetImage(views::Button::STATE_NORMAL, 240 SetImage(views::Button::STATE_NORMAL,
242 gfx::CreateVectorIcon(icon_id, kButtonSize, normal_color)); 241 gfx::CreatePrimaryVectorIcon(icon_id, normal_color));
243 SetImage(views::Button::STATE_DISABLED, 242 SetImage(views::Button::STATE_DISABLED,
244 gfx::CreateVectorIcon(icon_id, kButtonSize, disabled_color)); 243 gfx::CreatePrimaryVectorIcon(icon_id, disabled_color));
245 } else { 244 } else {
246 SetImage(views::Button::STATE_NORMAL, 245 SetImage(views::Button::STATE_NORMAL,
247 *(tp->GetImageSkiaNamed((mode == MODE_RELOAD) ? IDR_RELOAD 246 *(tp->GetImageSkiaNamed((mode == MODE_RELOAD) ? IDR_RELOAD
248 : IDR_STOP))); 247 : IDR_STOP)));
249 SetImage(views::Button::STATE_DISABLED, 248 SetImage(views::Button::STATE_DISABLED,
250 *(tp->GetImageSkiaNamed((mode == MODE_RELOAD) ? IDR_RELOAD_D 249 *(tp->GetImageSkiaNamed((mode == MODE_RELOAD) ? IDR_RELOAD_D
251 : IDR_STOP_D))); 250 : IDR_STOP_D)));
252 } 251 }
253 } 252 }
254 253
255 visible_mode_ = mode; 254 visible_mode_ = mode;
256 SchedulePaint(); 255 SchedulePaint();
257 } 256 }
258 257
259 void ReloadButton::OnDoubleClickTimer() { 258 void ReloadButton::OnDoubleClickTimer() {
260 if (!IsMenuShowing()) 259 if (!IsMenuShowing())
261 ChangeMode(intended_mode_, false); 260 ChangeMode(intended_mode_, false);
262 } 261 }
263 262
264 void ReloadButton::OnStopToReloadTimer() { 263 void ReloadButton::OnStopToReloadTimer() {
265 DCHECK(!IsMenuShowing()); 264 DCHECK(!IsMenuShowing());
266 ChangeMode(intended_mode_, true); 265 ChangeMode(intended_mode_, true);
267 } 266 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698