OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/tab_contents/web_contents_view_win.h" | 5 #include "chrome/browser/tab_contents/web_contents_view_win.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 | 8 |
9 #include "chrome/browser/bookmarks/bookmark_drag_data.h" | 9 #include "chrome/browser/bookmarks/bookmark_drag_data.h" |
10 #include "chrome/browser/browser.h" // TODO(beng): this dependency is awful. | 10 #include "chrome/browser/browser.h" // TODO(beng): this dependency is awful. |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 // KEY_DOWN events, even if the latter triggered an accelerator. In these | 252 // KEY_DOWN events, even if the latter triggered an accelerator. In these |
253 // cases, we discard the CHAR events. | 253 // cases, we discard the CHAR events. |
254 if (event.type == WebInputEvent::CHAR && ignore_next_char_event_) { | 254 if (event.type == WebInputEvent::CHAR && ignore_next_char_event_) { |
255 ignore_next_char_event_ = false; | 255 ignore_next_char_event_ = false; |
256 return; | 256 return; |
257 } | 257 } |
258 ignore_next_char_event_ = false; | 258 ignore_next_char_event_ = false; |
259 | 259 |
260 // The renderer returned a keyboard event it did not process. This may be | 260 // The renderer returned a keyboard event it did not process. This may be |
261 // a keyboard shortcut that we have to process. | 261 // a keyboard shortcut that we have to process. |
262 if (event.type == WebInputEvent::KEY_DOWN) { | 262 if (event.type == WebInputEvent::RAW_KEY_DOWN) { |
263 views::FocusManager* focus_manager = | 263 views::FocusManager* focus_manager = |
264 views::FocusManager::GetFocusManager(GetHWND()); | 264 views::FocusManager::GetFocusManager(GetHWND()); |
265 // We may not have a focus_manager at this point (if the tab has been | 265 // We may not have a focus_manager at this point (if the tab has been |
266 // switched by the time this message returned). | 266 // switched by the time this message returned). |
267 if (focus_manager) { | 267 if (focus_manager) { |
268 views::Accelerator accelerator(event.key_code, | 268 views::Accelerator accelerator(event.windows_key_code, |
269 (event.modifiers & WebInputEvent::SHIFT_KEY) == | 269 (event.modifiers & WebInputEvent::SHIFT_KEY) == |
270 WebInputEvent::SHIFT_KEY, | 270 WebInputEvent::SHIFT_KEY, |
271 (event.modifiers & WebInputEvent::CTRL_KEY) == | 271 (event.modifiers & WebInputEvent::CTRL_KEY) == |
272 WebInputEvent::CTRL_KEY, | 272 WebInputEvent::CTRL_KEY, |
273 (event.modifiers & WebInputEvent::ALT_KEY) == | 273 (event.modifiers & WebInputEvent::ALT_KEY) == |
274 WebInputEvent::ALT_KEY); | 274 WebInputEvent::ALT_KEY); |
275 | 275 |
276 // This is tricky: we want to set ignore_next_char_event_ if | 276 // This is tricky: we want to set ignore_next_char_event_ if |
277 // ProcessAccelerator returns true. But ProcessAccelerator might delete | 277 // ProcessAccelerator returns true. But ProcessAccelerator might delete |
278 // |this| if the accelerator is a "close tab" one. So we speculatively | 278 // |this| if the accelerator is a "close tab" one. So we speculatively |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
623 } | 623 } |
624 return false; | 624 return false; |
625 } | 625 } |
626 | 626 |
627 void WebContentsViewWin::WheelZoom(int distance) { | 627 void WebContentsViewWin::WheelZoom(int distance) { |
628 if (web_contents_->delegate()) { | 628 if (web_contents_->delegate()) { |
629 bool zoom_in = distance > 0; | 629 bool zoom_in = distance > 0; |
630 web_contents_->delegate()->ContentsZoomChange(zoom_in); | 630 web_contents_->delegate()->ContentsZoomChange(zoom_in); |
631 } | 631 } |
632 } | 632 } |
OLD | NEW |