Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: chrome/browser/ui/cocoa/profiles/user_manager_mac.mm

Issue 553133002: [Mac] Add text-editing accelerators to the User Manager. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: windows change not needed :/ Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 ||
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];
groby-ooo-7-16 2014/09/10 20:06:40 Technically, valid commandIds should be handled vi
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 };
72 75
73 // Window controller for the User Manager view. 76 // Window controller for the User Manager view.
74 @interface UserManagerWindowController : NSWindowController <NSWindowDelegate> { 77 @interface UserManagerWindowController : NSWindowController <NSWindowDelegate> {
75 @private 78 @private
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698