| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |