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

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

Issue 2305933002: Update dialog close buttons to use vector icons and ripples. (Closed)
Patch Set: always good to compile Created 4 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
« no previous file with comments | « chrome/browser/ui/views/infobars/infobar_view.cc ('k') | ui/views/BUILD.gn » ('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 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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 } 230 }
231 231
232 void ReloadButton::ChangeModeInternal(Mode mode) { 232 void ReloadButton::ChangeModeInternal(Mode mode) {
233 const ui::ThemeProvider* tp = GetThemeProvider(); 233 const ui::ThemeProvider* tp = GetThemeProvider();
234 // |tp| can be NULL in unit tests. 234 // |tp| can be NULL in unit tests.
235 if (tp) { 235 if (tp) {
236 if (ui::MaterialDesignController::IsModeMaterial()) { 236 if (ui::MaterialDesignController::IsModeMaterial()) {
237 const gfx::VectorIconId icon_id = (mode == MODE_RELOAD) 237 const gfx::VectorIconId icon_id = (mode == MODE_RELOAD)
238 ? gfx::VectorIconId::NAVIGATE_RELOAD 238 ? gfx::VectorIconId::NAVIGATE_RELOAD
239 : gfx::VectorIconId::NAVIGATE_STOP; 239 : gfx::VectorIconId::NAVIGATE_STOP;
240 const int kButtonSize = 16;
241 const SkColor normal_color = 240 const SkColor normal_color =
242 tp->GetColor(ThemeProperties::COLOR_TOOLBAR_BUTTON_ICON); 241 tp->GetColor(ThemeProperties::COLOR_TOOLBAR_BUTTON_ICON);
243 const SkColor disabled_color = 242 const SkColor disabled_color =
244 tp->GetColor(ThemeProperties::COLOR_TOOLBAR_BUTTON_ICON_INACTIVE); 243 tp->GetColor(ThemeProperties::COLOR_TOOLBAR_BUTTON_ICON_INACTIVE);
245 SetImage(views::Button::STATE_NORMAL, 244 SetImage(views::Button::STATE_NORMAL,
246 gfx::CreateVectorIcon(icon_id, kButtonSize, normal_color)); 245 gfx::CreateVectorIcon(icon_id, normal_color));
247 SetImage(views::Button::STATE_DISABLED, 246 SetImage(views::Button::STATE_DISABLED,
248 gfx::CreateVectorIcon(icon_id, kButtonSize, disabled_color)); 247 gfx::CreateVectorIcon(icon_id, disabled_color));
249 set_ink_drop_base_color(normal_color); 248 set_ink_drop_base_color(normal_color);
250 } else { 249 } else {
251 SetImage(views::Button::STATE_NORMAL, 250 SetImage(views::Button::STATE_NORMAL,
252 *(tp->GetImageSkiaNamed((mode == MODE_RELOAD) ? IDR_RELOAD 251 *(tp->GetImageSkiaNamed((mode == MODE_RELOAD) ? IDR_RELOAD
253 : IDR_STOP))); 252 : IDR_STOP)));
254 SetImage(views::Button::STATE_DISABLED, 253 SetImage(views::Button::STATE_DISABLED,
255 *(tp->GetImageSkiaNamed((mode == MODE_RELOAD) ? IDR_RELOAD_D 254 *(tp->GetImageSkiaNamed((mode == MODE_RELOAD) ? IDR_RELOAD_D
256 : IDR_STOP_D))); 255 : IDR_STOP_D)));
257 } 256 }
258 } 257 }
259 258
260 visible_mode_ = mode; 259 visible_mode_ = mode;
261 SchedulePaint(); 260 SchedulePaint();
262 } 261 }
263 262
264 void ReloadButton::OnDoubleClickTimer() { 263 void ReloadButton::OnDoubleClickTimer() {
265 if (!IsMenuShowing()) 264 if (!IsMenuShowing())
266 ChangeMode(intended_mode_, false); 265 ChangeMode(intended_mode_, false);
267 } 266 }
268 267
269 void ReloadButton::OnStopToReloadTimer() { 268 void ReloadButton::OnStopToReloadTimer() {
270 DCHECK(!IsMenuShowing()); 269 DCHECK(!IsMenuShowing());
271 ChangeMode(intended_mode_, true); 270 ChangeMode(intended_mode_, true);
272 } 271 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/infobars/infobar_view.cc ('k') | ui/views/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698