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

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

Issue 2614333002: Revert of Create vector icon resource directory specific to Chrome. (Closed)
Patch Set: Created 3 years, 11 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/app/vector_icons/vector_icons.h"
13 #include "chrome/browser/command_updater.h" 12 #include "chrome/browser/command_updater.h"
14 #include "chrome/browser/search/search.h" 13 #include "chrome/browser/search/search.h"
15 #include "chrome/browser/themes/theme_properties.h" 14 #include "chrome/browser/themes/theme_properties.h"
16 #include "chrome/browser/ui/search/search_model.h" 15 #include "chrome/browser/ui/search/search_model.h"
17 #include "chrome/grit/generated_resources.h" 16 #include "chrome/grit/generated_resources.h"
18 #include "chrome/grit/theme_resources.h" 17 #include "chrome/grit/theme_resources.h"
19 #include "ui/base/l10n/l10n_util.h" 18 #include "ui/base/l10n/l10n_util.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"
23 #include "ui/gfx/vector_icons_public.h"
24 #include "ui/views/metrics.h" 24 #include "ui/views/metrics.h"
25 #include "ui/views/widget/widget.h" 25 #include "ui/views/widget/widget.h"
26 26
27 27
28 namespace { 28 namespace {
29 29
30 // Contents of the Reload drop-down menu. 30 // Contents of the Reload drop-down menu.
31 const int kReloadMenuItems[] = { 31 const int kReloadMenuItems[] = {
32 IDS_RELOAD_MENU_NORMAL_RELOAD_ITEM, 32 IDS_RELOAD_MENU_NORMAL_RELOAD_ITEM,
33 IDS_RELOAD_MENU_HARD_RELOAD_ITEM, 33 IDS_RELOAD_MENU_HARD_RELOAD_ITEM,
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 if (!command_updater_) 225 if (!command_updater_)
226 return; 226 return;
227 command_updater_->ExecuteCommandWithDisposition( 227 command_updater_->ExecuteCommandWithDisposition(
228 command, ui::DispositionFromEventFlags(event_flags)); 228 command, ui::DispositionFromEventFlags(event_flags));
229 } 229 }
230 230
231 void ReloadButton::ChangeModeInternal(Mode mode) { 231 void ReloadButton::ChangeModeInternal(Mode mode) {
232 const ui::ThemeProvider* tp = GetThemeProvider(); 232 const ui::ThemeProvider* tp = GetThemeProvider();
233 // |tp| can be NULL in unit tests. 233 // |tp| can be NULL in unit tests.
234 if (tp) { 234 if (tp) {
235 const gfx::VectorIcon& icon = 235 const gfx::VectorIconId icon_id = (mode == MODE_RELOAD)
236 (mode == MODE_RELOAD) ? kNavigateReloadIcon : kNavigateStopIcon; 236 ? gfx::VectorIconId::NAVIGATE_RELOAD
237 : gfx::VectorIconId::NAVIGATE_STOP;
237 const SkColor normal_color = 238 const SkColor normal_color =
238 tp->GetColor(ThemeProperties::COLOR_TOOLBAR_BUTTON_ICON); 239 tp->GetColor(ThemeProperties::COLOR_TOOLBAR_BUTTON_ICON);
239 const SkColor disabled_color = 240 const SkColor disabled_color =
240 tp->GetColor(ThemeProperties::COLOR_TOOLBAR_BUTTON_ICON_INACTIVE); 241 tp->GetColor(ThemeProperties::COLOR_TOOLBAR_BUTTON_ICON_INACTIVE);
241 SetImage(views::Button::STATE_NORMAL, 242 SetImage(views::Button::STATE_NORMAL,
242 gfx::CreateVectorIcon(icon, normal_color)); 243 gfx::CreateVectorIcon(icon_id, normal_color));
243 SetImage(views::Button::STATE_DISABLED, 244 SetImage(views::Button::STATE_DISABLED,
244 gfx::CreateVectorIcon(icon, disabled_color)); 245 gfx::CreateVectorIcon(icon_id, disabled_color));
245 set_ink_drop_base_color(normal_color); 246 set_ink_drop_base_color(normal_color);
246 } 247 }
247 248
248 visible_mode_ = mode; 249 visible_mode_ = mode;
249 SchedulePaint(); 250 SchedulePaint();
250 } 251 }
251 252
252 void ReloadButton::OnDoubleClickTimer() { 253 void ReloadButton::OnDoubleClickTimer() {
253 if (!IsMenuShowing()) 254 if (!IsMenuShowing())
254 ChangeMode(intended_mode_, false); 255 ChangeMode(intended_mode_, false);
255 } 256 }
256 257
257 void ReloadButton::OnStopToReloadTimer() { 258 void ReloadButton::OnStopToReloadTimer() {
258 DCHECK(!IsMenuShowing()); 259 DCHECK(!IsMenuShowing());
259 ChangeMode(intended_mode_, true); 260 ChangeMode(intended_mode_, true);
260 } 261 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/toolbar/app_menu_button.cc ('k') | chrome/browser/ui/views/toolbar/toolbar_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698