OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/cocoa/profiles/user_manager_mac.h" | 5 #include "chrome/browser/ui/cocoa/profiles/user_manager_mac.h" |
6 | 6 |
7 #include "chrome/app/chrome_command_ids.h" | 7 #include "chrome/app/chrome_command_ids.h" |
8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
9 #include "chrome/browser/profiles/profile_manager.h" | 9 #include "chrome/browser/profiles/profile_manager.h" |
10 #include "chrome/browser/ui/browser_dialogs.h" | 10 #include "chrome/browser/ui/browser_dialogs.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
48 : window_(window) {} | 48 : window_(window) {} |
49 | 49 |
50 // WebContentsDelegate implementation. Forwards all unhandled keyboard events | 50 // WebContentsDelegate implementation. Forwards all unhandled keyboard events |
51 // to the current window. | 51 // to the current window. |
52 virtual void HandleKeyboardEvent( | 52 virtual void HandleKeyboardEvent( |
53 content::WebContents* source, | 53 content::WebContents* source, |
54 const content::NativeWebKeyboardEvent& event) OVERRIDE { | 54 const content::NativeWebKeyboardEvent& event) OVERRIDE { |
55 if (![BrowserWindowUtils shouldHandleKeyboardEvent:event]) | 55 if (![BrowserWindowUtils shouldHandleKeyboardEvent:event]) |
56 return; | 56 return; |
57 | 57 |
58 // -getCommandId returns -1 if the event isn't a chrome keyboard shortcut. | |
58 int commandId = [BrowserWindowUtils getCommandId:event]; | 59 int commandId = [BrowserWindowUtils getCommandId:event]; |
59 | 60 |
60 // Since the User Manager is a "top level" window, only handle close events. | 61 // From the chrome accelerators, only handle close window accelerators, and |
61 if (commandId == IDC_CLOSE_WINDOW || commandId == IDC_EXIT) { | 62 // allow all other accelerators to be handled by the web contents. |
63 if (commandId == -1 || commandId == IDC_CLOSE_WINDOW || | |
groby-ooo-7-16
2014/09/10 16:38:21
No support for IDC_CLOSE_TAB? (which is cmd-w. CLO
noms (inactive)
2014/09/10 16:55:09
According to https://code.google.com/p/chromium/co
groby-ooo-7-16
2014/09/10 20:06:40
Sigh. It turns out that the "Close window" entry i
| |
64 commandId == IDC_EXIT) { | |
62 // Not invoking +[BrowserWindowUtils handleKeyboardEvent here], since the | 65 // Not invoking +[BrowserWindowUtils handleKeyboardEvent here], since the |
63 // window in question is a ConstrainedWindowCustomWindow, not a | 66 // window in question is a ConstrainedWindowCustomWindow, not a |
64 // BrowserWindow. | 67 // BrowserWindow. |
65 [window_ redispatchKeyEvent:event.os_event]; | 68 [window_ redispatchKeyEvent:event.os_event]; |
66 } | 69 } |
67 } | 70 } |
68 | 71 |
69 private: | 72 private: |
70 ChromeEventProcessingWindow* window_; // Used to redispatch key events. | 73 ChromeEventProcessingWindow* window_; // Used to redispatch key events. |
71 }; | 74 }; |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
206 void UserManagerMac::OnGuestProfileCreated(Profile* guest_profile, | 209 void UserManagerMac::OnGuestProfileCreated(Profile* guest_profile, |
207 const std::string& url) { | 210 const std::string& url) { |
208 instance_ = new UserManagerMac(guest_profile); | 211 instance_ = new UserManagerMac(guest_profile); |
209 [instance_->window_controller_ showURL:GURL(url)]; | 212 [instance_->window_controller_ showURL:GURL(url)]; |
210 } | 213 } |
211 | 214 |
212 void UserManagerMac::WindowWasClosed() { | 215 void UserManagerMac::WindowWasClosed() { |
213 instance_ = NULL; | 216 instance_ = NULL; |
214 delete this; | 217 delete this; |
215 } | 218 } |
OLD | NEW |