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/gtk/reload_button_gtk.h" | 5 #include "chrome/browser/gtk/reload_button_gtk.h" |
6 | 6 |
7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "chrome/app/chrome_dll_resource.h" | 9 #include "chrome/app/chrome_dll_resource.h" |
10 #include "chrome/browser/browser.h" | 10 #include "chrome/browser/browser.h" |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 // The user has clicked, so we can feel free to update the button, | 122 // The user has clicked, so we can feel free to update the button, |
123 // even if the mouse is still hovering. | 123 // even if the mouse is still hovering. |
124 ChangeMode(MODE_RELOAD, true); | 124 ChangeMode(MODE_RELOAD, true); |
125 } else if (!timer_running()) { | 125 } else if (!timer_running()) { |
126 // Shift-clicking or Ctrl-clicking the reload button means we should ignore | 126 // Shift-clicking or Ctrl-clicking the reload button means we should ignore |
127 // any cached content. | 127 // any cached content. |
128 int command; | 128 int command; |
129 GdkModifierType modifier_state; | 129 GdkModifierType modifier_state; |
130 gtk_get_current_event_state(&modifier_state); | 130 gtk_get_current_event_state(&modifier_state); |
131 guint modifier_state_uint = modifier_state; | 131 guint modifier_state_uint = modifier_state; |
132 if (modifier_state_uint & GDK_SHIFT_MASK) { | 132 if (modifier_state_uint & (GDK_SHIFT_MASK | GDK_CONTROL_MASK)) { |
133 command = IDC_RELOAD_IGNORING_CACHE; | 133 command = IDC_RELOAD_IGNORING_CACHE; |
134 // Mask off shift so it isn't interpreted as affecting the disposition | 134 // Mask off Shift and Control so they don't affect the disposition below. |
135 // below. | 135 modifier_state_uint &= ~(GDK_SHIFT_MASK | GDK_CONTROL_MASK); |
136 modifier_state_uint &= ~GDK_SHIFT_MASK; | |
137 } else { | 136 } else { |
138 command = IDC_RELOAD; | 137 command = IDC_RELOAD; |
139 } | 138 } |
140 | 139 |
141 WindowOpenDisposition disposition = | 140 WindowOpenDisposition disposition = |
142 event_utils::DispositionFromEventFlags(modifier_state_uint); | 141 event_utils::DispositionFromEventFlags(modifier_state_uint); |
143 if (disposition == CURRENT_TAB) { | 142 if (disposition == CURRENT_TAB) { |
144 // Forcibly reset the location bar, since otherwise it won't discard any | 143 // Forcibly reset the location bar, since otherwise it won't discard any |
145 // ongoing user edits, since it doesn't realize this is a user-initiated | 144 // ongoing user edits, since it doesn't realize this is a user-initiated |
146 // action. | 145 // action. |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 reload_.Height()); | 208 reload_.Height()); |
210 | 209 |
211 gtk_widget_set_app_paintable(widget_.get(), TRUE); | 210 gtk_widget_set_app_paintable(widget_.get(), TRUE); |
212 // We effectively double-buffer by virtue of having only one image... | 211 // We effectively double-buffer by virtue of having only one image... |
213 gtk_widget_set_double_buffered(widget_.get(), FALSE); | 212 gtk_widget_set_double_buffered(widget_.get(), FALSE); |
214 } | 213 } |
215 | 214 |
216 gtk_chrome_button_set_use_gtk_rendering( | 215 gtk_chrome_button_set_use_gtk_rendering( |
217 GTK_CHROME_BUTTON(widget_.get()), use_gtk); | 216 GTK_CHROME_BUTTON(widget_.get()), use_gtk); |
218 } | 217 } |
OLD | NEW |