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

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

Issue 2374803002: Remove a bunch of pre-MD toolbar code and assets. (Closed)
Patch Set: fix mac? Created 4 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 <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"
11 #include "chrome/app/chrome_command_ids.h" 11 #include "chrome/app/chrome_command_ids.h"
12 #include "chrome/browser/command_updater.h" 12 #include "chrome/browser/command_updater.h"
13 #include "chrome/browser/search/search.h" 13 #include "chrome/browser/search/search.h"
14 #include "chrome/browser/themes/theme_properties.h" 14 #include "chrome/browser/themes/theme_properties.h"
15 #include "chrome/browser/ui/search/search_model.h" 15 #include "chrome/browser/ui/search/search_model.h"
16 #include "chrome/grit/generated_resources.h" 16 #include "chrome/grit/generated_resources.h"
17 #include "chrome/grit/theme_resources.h" 17 #include "chrome/grit/theme_resources.h"
18 #include "ui/base/l10n/l10n_util.h" 18 #include "ui/base/l10n/l10n_util.h"
19 #include "ui/base/material_design/material_design_controller.h"
20 #include "ui/base/models/simple_menu_model.h" 19 #include "ui/base/models/simple_menu_model.h"
21 #include "ui/base/theme_provider.h" 20 #include "ui/base/theme_provider.h"
22 #include "ui/base/window_open_disposition.h" 21 #include "ui/base/window_open_disposition.h"
23 #include "ui/gfx/paint_vector_icon.h" 22 #include "ui/gfx/paint_vector_icon.h"
24 #include "ui/gfx/vector_icons_public.h" 23 #include "ui/gfx/vector_icons_public.h"
25 #include "ui/views/metrics.h" 24 #include "ui/views/metrics.h"
26 #include "ui/views/widget/widget.h" 25 #include "ui/views/widget/widget.h"
27 26
28 27
29 namespace { 28 namespace {
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 if (!command_updater_) 225 if (!command_updater_)
227 return; 226 return;
228 command_updater_->ExecuteCommandWithDisposition( 227 command_updater_->ExecuteCommandWithDisposition(
229 command, ui::DispositionFromEventFlags(event_flags)); 228 command, ui::DispositionFromEventFlags(event_flags));
230 } 229 }
231 230
232 void ReloadButton::ChangeModeInternal(Mode mode) { 231 void ReloadButton::ChangeModeInternal(Mode mode) {
233 const ui::ThemeProvider* tp = GetThemeProvider(); 232 const ui::ThemeProvider* tp = GetThemeProvider();
234 // |tp| can be NULL in unit tests. 233 // |tp| can be NULL in unit tests.
235 if (tp) { 234 if (tp) {
236 if (ui::MaterialDesignController::IsModeMaterial()) { 235 const gfx::VectorIconId icon_id = (mode == MODE_RELOAD)
237 const gfx::VectorIconId icon_id = (mode == MODE_RELOAD) 236 ? gfx::VectorIconId::NAVIGATE_RELOAD
238 ? gfx::VectorIconId::NAVIGATE_RELOAD 237 : gfx::VectorIconId::NAVIGATE_STOP;
239 : gfx::VectorIconId::NAVIGATE_STOP; 238 const SkColor normal_color =
240 const SkColor normal_color = 239 tp->GetColor(ThemeProperties::COLOR_TOOLBAR_BUTTON_ICON);
241 tp->GetColor(ThemeProperties::COLOR_TOOLBAR_BUTTON_ICON); 240 const SkColor disabled_color =
242 const SkColor disabled_color = 241 tp->GetColor(ThemeProperties::COLOR_TOOLBAR_BUTTON_ICON_INACTIVE);
243 tp->GetColor(ThemeProperties::COLOR_TOOLBAR_BUTTON_ICON_INACTIVE); 242 SetImage(views::Button::STATE_NORMAL,
244 SetImage(views::Button::STATE_NORMAL, 243 gfx::CreateVectorIcon(icon_id, normal_color));
245 gfx::CreateVectorIcon(icon_id, normal_color)); 244 SetImage(views::Button::STATE_DISABLED,
246 SetImage(views::Button::STATE_DISABLED, 245 gfx::CreateVectorIcon(icon_id, disabled_color));
247 gfx::CreateVectorIcon(icon_id, disabled_color)); 246 set_ink_drop_base_color(normal_color);
248 set_ink_drop_base_color(normal_color);
249 } else {
250 SetImage(views::Button::STATE_NORMAL,
251 *(tp->GetImageSkiaNamed((mode == MODE_RELOAD) ? IDR_RELOAD
252 : IDR_STOP)));
253 SetImage(views::Button::STATE_DISABLED,
254 *(tp->GetImageSkiaNamed((mode == MODE_RELOAD) ? IDR_RELOAD_D
255 : IDR_STOP_D)));
256 }
257 } 247 }
258 248
259 visible_mode_ = mode; 249 visible_mode_ = mode;
260 SchedulePaint(); 250 SchedulePaint();
261 } 251 }
262 252
263 void ReloadButton::OnDoubleClickTimer() { 253 void ReloadButton::OnDoubleClickTimer() {
264 if (!IsMenuShowing()) 254 if (!IsMenuShowing())
265 ChangeMode(intended_mode_, false); 255 ChangeMode(intended_mode_, false);
266 } 256 }
267 257
268 void ReloadButton::OnStopToReloadTimer() { 258 void ReloadButton::OnStopToReloadTimer() {
269 DCHECK(!IsMenuShowing()); 259 DCHECK(!IsMenuShowing());
270 ChangeMode(intended_mode_, true); 260 ChangeMode(intended_mode_, true);
271 } 261 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698