OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/event_disposition.h" |
9 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
10 #include "chrome/browser/ui/views/event_utils.h" | |
11 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" | 11 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
12 #include "grit/generated_resources.h" | 12 #include "grit/generated_resources.h" |
13 #include "ui/base/l10n/l10n_util.h" | 13 #include "ui/base/l10n/l10n_util.h" |
14 #include "views/metrics.h" | 14 #include "views/metrics.h" |
15 | 15 |
16 // static | 16 // static |
17 const char ReloadButton::kViewClassName[] = "browser/ui/views/ReloadButton"; | 17 const char ReloadButton::kViewClassName[] = "browser/ui/views/ReloadButton"; |
18 | 18 |
19 //////////////////////////////////////////////////////////////////////////////// | 19 //////////////////////////////////////////////////////////////////////////////// |
20 // ReloadButton, public: | 20 // ReloadButton, public: |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 int flags = mouse_event_flags(); | 86 int flags = mouse_event_flags(); |
87 if (event.IsShiftDown() || event.IsControlDown()) { | 87 if (event.IsShiftDown() || event.IsControlDown()) { |
88 command = IDC_RELOAD_IGNORING_CACHE; | 88 command = IDC_RELOAD_IGNORING_CACHE; |
89 // Mask off Shift and Control so they don't affect the disposition below. | 89 // Mask off Shift and Control so they don't affect the disposition below. |
90 flags &= ~(ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN); | 90 flags &= ~(ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN); |
91 } else { | 91 } else { |
92 command = IDC_RELOAD; | 92 command = IDC_RELOAD; |
93 } | 93 } |
94 | 94 |
95 WindowOpenDisposition disposition = | 95 WindowOpenDisposition disposition = |
96 event_utils::DispositionFromEventFlags(flags); | 96 browser::DispositionFromEventFlags(flags); |
97 if ((disposition == CURRENT_TAB) && location_bar_) { | 97 if ((disposition == CURRENT_TAB) && location_bar_) { |
98 // Forcibly reset the location bar, since otherwise it won't discard any | 98 // Forcibly reset the location bar, since otherwise it won't discard any |
99 // ongoing user edits, since it doesn't realize this is a user-initiated | 99 // ongoing user edits, since it doesn't realize this is a user-initiated |
100 // action. | 100 // action. |
101 location_bar_->Revert(); | 101 location_bar_->Revert(); |
102 } | 102 } |
103 | 103 |
104 // Start a timer - while this timer is running, the reload button cannot be | 104 // Start a timer - while this timer is running, the reload button cannot be |
105 // changed to a stop button. We do not set |intended_mode_| to MODE_STOP | 105 // changed to a stop button. We do not set |intended_mode_| to MODE_STOP |
106 // here as the browser will do that when it actually starts loading (which | 106 // here as the browser will do that when it actually starts loading (which |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 //////////////////////////////////////////////////////////////////////////////// | 138 //////////////////////////////////////////////////////////////////////////////// |
139 // ReloadButton, private: | 139 // ReloadButton, private: |
140 | 140 |
141 void ReloadButton::OnDoubleClickTimer() { | 141 void ReloadButton::OnDoubleClickTimer() { |
142 ChangeMode(intended_mode_, false); | 142 ChangeMode(intended_mode_, false); |
143 } | 143 } |
144 | 144 |
145 void ReloadButton::OnStopToReloadTimer() { | 145 void ReloadButton::OnStopToReloadTimer() { |
146 ChangeMode(intended_mode_, true); | 146 ChangeMode(intended_mode_, true); |
147 } | 147 } |
OLD | NEW |