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

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

Issue 1492423003: Rejigger ThemeService: move exposure of ThemeProvider interface to a (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix that unittest 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
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 22 matching lines...) Expand all
33 }; 33 };
34 34
35 } // namespace 35 } // namespace
36 36
37 37
38 // ReloadButton --------------------------------------------------------------- 38 // ReloadButton ---------------------------------------------------------------
39 39
40 // static 40 // static
41 const char ReloadButton::kViewClassName[] = "ReloadButton"; 41 const char ReloadButton::kViewClassName[] = "ReloadButton";
42 42
43 ReloadButton::ReloadButton(CommandUpdater* command_updater) 43 ReloadButton::ReloadButton(Profile* profile, CommandUpdater* command_updater)
44 : ToolbarButton(this, CreateMenuModel()), 44 : ToolbarButton(profile, this, CreateMenuModel()),
45 command_updater_(command_updater), 45 command_updater_(command_updater),
46 intended_mode_(MODE_RELOAD), 46 intended_mode_(MODE_RELOAD),
47 visible_mode_(MODE_RELOAD), 47 visible_mode_(MODE_RELOAD),
48 double_click_timer_delay_( 48 double_click_timer_delay_(
49 base::TimeDelta::FromMilliseconds(views::GetDoubleClickInterval())), 49 base::TimeDelta::FromMilliseconds(views::GetDoubleClickInterval())),
50 stop_to_reload_timer_delay_(base::TimeDelta::FromMilliseconds(1350)), 50 stop_to_reload_timer_delay_(base::TimeDelta::FromMilliseconds(1350)),
51 menu_enabled_(false), 51 menu_enabled_(false),
52 testing_mouse_hovered_(false), 52 testing_mouse_hovered_(false),
53 testing_reload_count_(0) { 53 testing_reload_count_(0) {}
54 }
55 54
56 ReloadButton::~ReloadButton() { 55 ReloadButton::~ReloadButton() {
57 } 56 }
58 57
59 void ReloadButton::ChangeMode(Mode mode, bool force) { 58 void ReloadButton::ChangeMode(Mode mode, bool force) {
60 intended_mode_ = mode; 59 intended_mode_ = mode;
61 60
62 // If the change is forced, or the user isn't hovering the icon, or it's safe 61 // If the change is forced, or the user isn't hovering the icon, or it's safe
63 // to change it to the other image type, make the change immediately; 62 // to change it to the other image type, make the change immediately;
64 // otherwise we'll let it happen later. 63 // otherwise we'll let it happen later.
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
« no previous file with comments | « chrome/browser/ui/views/toolbar/reload_button.h ('k') | chrome/browser/ui/views/toolbar/reload_button_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698