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

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

Issue 2168953002: Disables the context menu in User Manager's reauth dialog (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments Created 4 years, 5 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 | chrome/browser/ui/user_manager.h » ('j') | chrome/browser/ui/user_manager.h » ('J')
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 "base/callback.h" 7 #include "base/callback.h"
8 #include "base/mac/foundation_util.h" 8 #include "base/mac/foundation_util.h"
9 #include "chrome/app/chrome_command_ids.h" 9 #include "chrome/app/chrome_command_ids.h"
10 #import "chrome/browser/app_controller_mac.h" 10 #import "chrome/browser/app_controller_mac.h"
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 BOOL isTextEditingCommand = [BrowserWindowUtils isTextEditingEvent:event]; 134 BOOL isTextEditingCommand = [BrowserWindowUtils isTextEditingEvent:event];
135 135
136 // Only handle close window Chrome accelerators and text editing ones. 136 // Only handle close window Chrome accelerators and text editing ones.
137 if (chromeCommandId == IDC_CLOSE_WINDOW || chromeCommandId == IDC_EXIT || 137 if (chromeCommandId == IDC_CLOSE_WINDOW || chromeCommandId == IDC_EXIT ||
138 isTextEditingCommand) { 138 isTextEditingCommand) {
139 [[NSApp mainMenu] performKeyEquivalent:event.os_event]; 139 [[NSApp mainMenu] performKeyEquivalent:event.os_event];
140 } 140 }
141 } 141 }
142 }; 142 };
143 143
144 class ReauthDialogDelegate : public UserManager::ReauthDialogObserver, 144 class ReauthDialogDelegate : public UserManager::BaseReauthDialogDelegate,
145 public UserManagerWebContentsDelegate,
146 public ConstrainedWindowMacDelegate { 145 public ConstrainedWindowMacDelegate {
147 public: 146 public:
148 ReauthDialogDelegate(content::WebContents* web_contents, 147 ReauthDialogDelegate(content::WebContents* web_contents,
149 const std::string& email) 148 const std::string& email)
150 : UserManager::ReauthDialogObserver(web_contents, email) {} 149 : UserManager::BaseReauthDialogDelegate(web_contents) {
150 hotKeysWebContentsDelegate_.reset(new UserManagerWebContentsDelegate());
151 }
151 152
152 // UserManager::ReauthDialogObserver: 153 // UserManager::BaseReauthDialogDelegate:
153 void CloseReauthDialog() override { 154 void CloseReauthDialog() override {
154 CloseInstanceReauthDialog(); 155 CloseInstanceReauthDialog();
155 } 156 }
156 157
158 // WebContentsDelegate::HandleKeyboardEvent:
159 void HandleKeyboardEvent(
160 content::WebContents* source,
161 const content::NativeWebKeyboardEvent& event) override {
162 hotKeysWebContentsDelegate_->HandleKeyboardEvent(source, event);
163 }
164
157 // ConstrainedWindowMacDelegate: 165 // ConstrainedWindowMacDelegate:
158 void OnConstrainedWindowClosed(ConstrainedWindowMac* window) override { 166 void OnConstrainedWindowClosed(ConstrainedWindowMac* window) override {
159 CloseReauthDialog(); 167 CloseReauthDialog();
160 } 168 }
161 169
170 private:
171 std::unique_ptr<UserManagerWebContentsDelegate> hotKeysWebContentsDelegate_;
172
162 DISALLOW_COPY_AND_ASSIGN(ReauthDialogDelegate); 173 DISALLOW_COPY_AND_ASSIGN(ReauthDialogDelegate);
163 }; 174 };
164 175
165 // WindowController for the reauth dialog. 176 // WindowController for the reauth dialog.
166 @interface ReauthDialogWindowController 177 @interface ReauthDialogWindowController
167 : NSWindowController <NSWindowDelegate> { 178 : NSWindowController <NSWindowDelegate> {
168 @private 179 @private
169 std::string emailAddress_; 180 std::string emailAddress_;
170 content::WebContents* webContents_; 181 content::WebContents* webContents_;
171 signin_metrics::Reason reason_; 182 signin_metrics::Reason reason_;
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 ProfileMetrics::LogTimeToOpenUserManager( 529 ProfileMetrics::LogTimeToOpenUserManager(
519 base::Time::Now() - user_manager_started_showing_); 530 base::Time::Now() - user_manager_started_showing_);
520 user_manager_started_showing_ = base::Time(); 531 user_manager_started_showing_ = base::Time();
521 } 532 }
522 533
523 void UserManagerMac::WindowWasClosed() { 534 void UserManagerMac::WindowWasClosed() {
524 CloseReauthDialog(); 535 CloseReauthDialog();
525 instance_ = NULL; 536 instance_ = NULL;
526 delete this; 537 delete this;
527 } 538 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/user_manager.h » ('j') | chrome/browser/ui/user_manager.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698