OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #import "chrome/browser/cocoa/html_dialog_window_controller.h" | 5 #import "chrome/browser/cocoa/html_dialog_window_controller.h" |
6 | 6 |
7 #include "app/keyboard_codes.h" | 7 #include "base/keyboard_codes.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/scoped_nsobject.h" | 9 #include "base/scoped_nsobject.h" |
10 #include "base/sys_string_conversions.h" | 10 #include "base/sys_string_conversions.h" |
11 #import "chrome/browser/cocoa/browser_command_executor.h" | 11 #import "chrome/browser/cocoa/browser_command_executor.h" |
12 #import "chrome/browser/cocoa/chrome_event_processing_window.h" | 12 #import "chrome/browser/cocoa/chrome_event_processing_window.h" |
13 #include "chrome/browser/dom_ui/html_dialog_ui.h" | 13 #include "chrome/browser/dom_ui/html_dialog_ui.h" |
14 #include "chrome/browser/dom_ui/html_dialog_tab_contents_delegate.h" | 14 #include "chrome/browser/dom_ui/html_dialog_tab_contents_delegate.h" |
15 #include "chrome/browser/profile.h" | 15 #include "chrome/browser/profile.h" |
16 #include "chrome/browser/tab_contents/tab_contents.h" | 16 #include "chrome/browser/tab_contents/tab_contents.h" |
17 #include "chrome/common/native_web_keyboard_event.h" | 17 #include "chrome/common/native_web_keyboard_event.h" |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 // since we handle keyboard events ourselves we can't do that. | 187 // since we handle keyboard events ourselves we can't do that. |
188 // | 188 // |
189 // According to experiments, hitting Esc works regardless of the | 189 // According to experiments, hitting Esc works regardless of the |
190 // presence of other modifiers (as long as it's not an app-level | 190 // presence of other modifiers (as long as it's not an app-level |
191 // shortcut, e.g. Commmand-Esc for Front Row) but no other modifiers | 191 // shortcut, e.g. Commmand-Esc for Front Row) but no other modifiers |
192 // can be present for Command-. to work. | 192 // can be present for Command-. to work. |
193 // | 193 // |
194 // TODO(thakis): It would be nice to get cancel: to work somehow. | 194 // TODO(thakis): It would be nice to get cancel: to work somehow. |
195 // Bug: http://code.google.com/p/chromium/issues/detail?id=32828 . | 195 // Bug: http://code.google.com/p/chromium/issues/detail?id=32828 . |
196 if (event.type == NativeWebKeyboardEvent::RawKeyDown && | 196 if (event.type == NativeWebKeyboardEvent::RawKeyDown && |
197 ((event.windowsKeyCode == app::VKEY_ESCAPE) || | 197 ((event.windowsKeyCode == base::VKEY_ESCAPE) || |
198 (event.windowsKeyCode == app::VKEY_OEM_PERIOD && | 198 (event.windowsKeyCode == base::VKEY_OEM_PERIOD && |
199 event.modifiers == NativeWebKeyboardEvent::MetaKey))) { | 199 event.modifiers == NativeWebKeyboardEvent::MetaKey))) { |
200 [controller_ close]; | 200 [controller_ close]; |
201 return; | 201 return; |
202 } | 202 } |
203 | 203 |
204 ChromeEventProcessingWindow* event_window = | 204 ChromeEventProcessingWindow* event_window = |
205 static_cast<ChromeEventProcessingWindow*>([controller_ window]); | 205 static_cast<ChromeEventProcessingWindow*>([controller_ window]); |
206 DCHECK([event_window isKindOfClass:[ChromeEventProcessingWindow class]]); | 206 DCHECK([event_window isKindOfClass:[ChromeEventProcessingWindow class]]); |
207 [event_window redispatchKeyEvent:event.os_event]; | 207 [event_window redispatchKeyEvent:event.os_event]; |
208 } | 208 } |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 // TODO(akalin): Figure out why implementing (void)cancel:(id)sender | 283 // TODO(akalin): Figure out why implementing (void)cancel:(id)sender |
284 // to do the above doesn't work. | 284 // to do the above doesn't work. |
285 } | 285 } |
286 | 286 |
287 - (void)windowWillClose:(NSNotification*)notification { | 287 - (void)windowWillClose:(NSNotification*)notification { |
288 delegate_->WindowControllerClosed(); | 288 delegate_->WindowControllerClosed(); |
289 [self autorelease]; | 289 [self autorelease]; |
290 } | 290 } |
291 | 291 |
292 @end | 292 @end |
OLD | NEW |