OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/reload_button.h" | 5 #include "chrome/browser/ui/views/reload_button.h" |
6 | 6 |
7 #include "base/utf_string_conversions.h" | 7 #include "base/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/instant/search.h" | |
11 #include "chrome/browser/ui/search/search_model.h" | |
12 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" | 10 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
13 #include "grit/generated_resources.h" | 11 #include "grit/generated_resources.h" |
14 #include "grit/theme_resources.h" | 12 #include "grit/theme_resources.h" |
15 #include "ui/base/l10n/l10n_util.h" | 13 #include "ui/base/l10n/l10n_util.h" |
16 #include "ui/base/models/simple_menu_model.h" | 14 #include "ui/base/models/simple_menu_model.h" |
17 #include "ui/base/theme_provider.h" | 15 #include "ui/base/theme_provider.h" |
18 #include "ui/base/window_open_disposition.h" | 16 #include "ui/base/window_open_disposition.h" |
19 #include "ui/views/metrics.h" | 17 #include "ui/views/metrics.h" |
20 #include "ui/views/widget/widget.h" | 18 #include "ui/views/widget/widget.h" |
21 | 19 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 ((mode == MODE_STOP) ? | 63 ((mode == MODE_STOP) ? |
66 !double_click_timer_.IsRunning() : (visible_mode_ != MODE_STOP))) { | 64 !double_click_timer_.IsRunning() : (visible_mode_ != MODE_STOP))) { |
67 double_click_timer_.Stop(); | 65 double_click_timer_.Stop(); |
68 stop_to_reload_timer_.Stop(); | 66 stop_to_reload_timer_.Stop(); |
69 ChangeModeInternal(mode); | 67 ChangeModeInternal(mode); |
70 SetEnabled(true); | 68 SetEnabled(true); |
71 | 69 |
72 // We want to disable the button if we're preventing a change from stop to | 70 // We want to disable the button if we're preventing a change from stop to |
73 // reload due to hovering, but not if we're preventing a change from reload to | 71 // reload due to hovering, but not if we're preventing a change from reload to |
74 // stop due to the double-click timer running. (Disabled reload state is only | 72 // stop due to the double-click timer running. (Disabled reload state is only |
75 // applicable when instant extended API is enabled and mode is NTP, which is | 73 // applicable when Instant Extended API is enabled and mode is NTP, which is |
76 // handled just above.) | 74 // handled just above.) |
77 } else if (visible_mode_ != MODE_RELOAD) { | 75 } else if (visible_mode_ != MODE_RELOAD) { |
78 SetEnabled(false); | 76 SetEnabled(false); |
79 | 77 |
80 // Go ahead and change to reload after a bit, which allows repeated reloads | 78 // Go ahead and change to reload after a bit, which allows repeated reloads |
81 // without moving the mouse. | 79 // without moving the mouse. |
82 if (!stop_to_reload_timer_.IsRunning()) { | 80 if (!stop_to_reload_timer_.IsRunning()) { |
83 stop_to_reload_timer_.Start(FROM_HERE, stop_to_reload_timer_delay_, this, | 81 stop_to_reload_timer_.Start(FROM_HERE, stop_to_reload_timer_delay_, this, |
84 &ReloadButton::OnStopToReloadTimer); | 82 &ReloadButton::OnStopToReloadTimer); |
85 } | 83 } |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 | 261 |
264 void ReloadButton::OnDoubleClickTimer() { | 262 void ReloadButton::OnDoubleClickTimer() { |
265 if (!IsMenuShowing()) | 263 if (!IsMenuShowing()) |
266 ChangeMode(intended_mode_, false); | 264 ChangeMode(intended_mode_, false); |
267 } | 265 } |
268 | 266 |
269 void ReloadButton::OnStopToReloadTimer() { | 267 void ReloadButton::OnStopToReloadTimer() { |
270 DCHECK(!IsMenuShowing()); | 268 DCHECK(!IsMenuShowing()); |
271 ChangeMode(intended_mode_, true); | 269 ChangeMode(intended_mode_, true); |
272 } | 270 } |
OLD | NEW |