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 "base/mac/foundation_util.h" | 7 #include "base/mac/foundation_util.h" |
8 #include "chrome/app/chrome_command_ids.h" | 8 #include "chrome/app/chrome_command_ids.h" |
9 #import "chrome/browser/app_controller_mac.h" | 9 #import "chrome/browser/app_controller_mac.h" |
10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 // is reset to NULL when the window is closed. | 26 // is reset to NULL when the window is closed. |
27 UserManagerMac* instance_ = NULL; // Weak. | 27 UserManagerMac* instance_ = NULL; // Weak. |
28 | 28 |
29 // Custom WebContentsDelegate that allows handling of hotkeys. | 29 // Custom WebContentsDelegate that allows handling of hotkeys. |
30 class UserManagerWebContentsDelegate : public content::WebContentsDelegate { | 30 class UserManagerWebContentsDelegate : public content::WebContentsDelegate { |
31 public: | 31 public: |
32 UserManagerWebContentsDelegate() {} | 32 UserManagerWebContentsDelegate() {} |
33 | 33 |
34 // WebContentsDelegate implementation. Forwards all unhandled keyboard events | 34 // WebContentsDelegate implementation. Forwards all unhandled keyboard events |
35 // to the current window. | 35 // to the current window. |
36 virtual void HandleKeyboardEvent( | 36 void HandleKeyboardEvent( |
37 content::WebContents* source, | 37 content::WebContents* source, |
38 const content::NativeWebKeyboardEvent& event) override { | 38 const content::NativeWebKeyboardEvent& event) override { |
39 if (![BrowserWindowUtils shouldHandleKeyboardEvent:event]) | 39 if (![BrowserWindowUtils shouldHandleKeyboardEvent:event]) |
40 return; | 40 return; |
41 | 41 |
42 // -getCommandId returns -1 if the event isn't a chrome accelerator. | 42 // -getCommandId returns -1 if the event isn't a chrome accelerator. |
43 int chromeCommandId = [BrowserWindowUtils getCommandId:event]; | 43 int chromeCommandId = [BrowserWindowUtils getCommandId:event]; |
44 | 44 |
45 // Check for Cmd+A and Cmd+V events that could come from a password field. | 45 // Check for Cmd+A and Cmd+V events that could come from a password field. |
46 bool isTextEditingCommand = | 46 bool isTextEditingCommand = |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 const std::string& url) { | 204 const std::string& url) { |
205 DCHECK(!instance_); | 205 DCHECK(!instance_); |
206 instance_ = new UserManagerMac(guest_profile); | 206 instance_ = new UserManagerMac(guest_profile); |
207 [instance_->window_controller() showURL:GURL(url)]; | 207 [instance_->window_controller() showURL:GURL(url)]; |
208 } | 208 } |
209 | 209 |
210 void UserManagerMac::WindowWasClosed() { | 210 void UserManagerMac::WindowWasClosed() { |
211 instance_ = NULL; | 211 instance_ = NULL; |
212 delete this; | 212 delete this; |
213 } | 213 } |
OLD | NEW |