OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/views/reload_button.h" | 5 #include "chrome/browser/views/reload_button.h" |
6 | 6 |
7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "chrome/app/chrome_dll_resource.h" | 8 #include "chrome/app/chrome_dll_resource.h" |
9 #include "chrome/browser/browser.h" | 9 #include "chrome/browser/browser.h" |
10 #include "chrome/browser/views/event_utils.h" | 10 #include "chrome/browser/views/event_utils.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 ChangeMode(MODE_RELOAD, true); | 52 ChangeMode(MODE_RELOAD, true); |
53 } else if (!timer_.IsRunning()) { | 53 } else if (!timer_.IsRunning()) { |
54 // Shift-clicking or ctrl-clicking the reload button means we should ignore | 54 // Shift-clicking or ctrl-clicking the reload button means we should ignore |
55 // any cached content. | 55 // any cached content. |
56 // TODO(avayvod): eliminate duplication of this logic in | 56 // TODO(avayvod): eliminate duplication of this logic in |
57 // CompactLocationBarView. | 57 // CompactLocationBarView. |
58 int command; | 58 int command; |
59 int flags = mouse_event_flags(); | 59 int flags = mouse_event_flags(); |
60 if (event.IsShiftDown() || event.IsControlDown()) { | 60 if (event.IsShiftDown() || event.IsControlDown()) { |
61 command = IDC_RELOAD_IGNORING_CACHE; | 61 command = IDC_RELOAD_IGNORING_CACHE; |
62 // Mask off shift/ctrl so they aren't interpreted as affecting the | 62 // Mask off Shift and Control so they don't affect the disposition below. |
63 // disposition below. | |
64 flags &= ~(views::Event::EF_SHIFT_DOWN | views::Event::EF_CONTROL_DOWN); | 63 flags &= ~(views::Event::EF_SHIFT_DOWN | views::Event::EF_CONTROL_DOWN); |
65 } else { | 64 } else { |
66 command = IDC_RELOAD; | 65 command = IDC_RELOAD; |
67 } | 66 } |
68 | 67 |
69 WindowOpenDisposition disposition = | 68 WindowOpenDisposition disposition = |
70 event_utils::DispositionFromEventFlags(flags); | 69 event_utils::DispositionFromEventFlags(flags); |
71 if (disposition == CURRENT_TAB) { | 70 if (disposition == CURRENT_TAB) { |
72 // Forcibly reset the location bar, since otherwise it won't discard any | 71 // Forcibly reset the location bar, since otherwise it won't discard any |
73 // ongoing user edits, since it doesn't realize this is a user-initiated | 72 // ongoing user edits, since it doesn't realize this is a user-initiated |
(...skipping 29 matching lines...) Expand all Loading... |
103 IDS_TOOLTIP_RELOAD : IDS_TOOLTIP_STOP)); | 102 IDS_TOOLTIP_RELOAD : IDS_TOOLTIP_STOP)); |
104 return true; | 103 return true; |
105 } | 104 } |
106 | 105 |
107 //////////////////////////////////////////////////////////////////////////////// | 106 //////////////////////////////////////////////////////////////////////////////// |
108 // ReloadButton, private: | 107 // ReloadButton, private: |
109 | 108 |
110 void ReloadButton::OnButtonTimer() { | 109 void ReloadButton::OnButtonTimer() { |
111 ChangeMode(intended_mode_, true); | 110 ChangeMode(intended_mode_, true); |
112 } | 111 } |
OLD | NEW |