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/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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 override { | 100 override { |
101 return modal_host_.get(); | 101 return modal_host_.get(); |
102 } | 102 } |
103 | 103 |
104 bool IsWebContentsVisible(content::WebContents* web_contents) override { | 104 bool IsWebContentsVisible(content::WebContents* web_contents) override { |
105 return true; | 105 return true; |
106 } | 106 } |
107 | 107 |
108 ~UserManagerModalManagerDelegate() override {} | 108 ~UserManagerModalManagerDelegate() override {} |
109 protected: | 109 protected: |
110 scoped_ptr<UserManagerModalHost> modal_host_; | 110 std::unique_ptr<UserManagerModalHost> modal_host_; |
111 }; | 111 }; |
112 | 112 |
113 // Custom WebContentsDelegate that allows handling of hotkeys. | 113 // Custom WebContentsDelegate that allows handling of hotkeys. |
114 class UserManagerWebContentsDelegate : public content::WebContentsDelegate { | 114 class UserManagerWebContentsDelegate : public content::WebContentsDelegate { |
115 public: | 115 public: |
116 UserManagerWebContentsDelegate() {} | 116 UserManagerWebContentsDelegate() {} |
117 | 117 |
118 // WebContentsDelegate implementation. Forwards all unhandled keyboard events | 118 // WebContentsDelegate implementation. Forwards all unhandled keyboard events |
119 // to the current window. | 119 // to the current window. |
120 void HandleKeyboardEvent( | 120 void HandleKeyboardEvent( |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 | 157 |
158 DISALLOW_COPY_AND_ASSIGN(ReauthDialogDelegate); | 158 DISALLOW_COPY_AND_ASSIGN(ReauthDialogDelegate); |
159 }; | 159 }; |
160 | 160 |
161 // WindowController for the reauth dialog. | 161 // WindowController for the reauth dialog. |
162 @interface ReauthDialogWindowController | 162 @interface ReauthDialogWindowController |
163 : NSWindowController <NSWindowDelegate> { | 163 : NSWindowController <NSWindowDelegate> { |
164 @private | 164 @private |
165 std::string emailAddress_; | 165 std::string emailAddress_; |
166 content::WebContents* webContents_; | 166 content::WebContents* webContents_; |
167 scoped_ptr<ReauthDialogDelegate> webContentsDelegate_; | 167 std::unique_ptr<ReauthDialogDelegate> webContentsDelegate_; |
168 scoped_ptr<ConstrainedWindowMac> constrained_window_; | 168 std::unique_ptr<ConstrainedWindowMac> constrained_window_; |
169 scoped_ptr<content::WebContents> reauthWebContents_; | 169 std::unique_ptr<content::WebContents> reauthWebContents_; |
170 } | 170 } |
171 - (id)initWithProfile:(Profile*)profile | 171 - (id)initWithProfile:(Profile*)profile |
172 email:(std::string)email | 172 email:(std::string)email |
173 webContents:(content::WebContents*)webContents; | 173 webContents:(content::WebContents*)webContents; |
174 - (void)close; | 174 - (void)close; |
175 @end | 175 @end |
176 | 176 |
177 @implementation ReauthDialogWindowController | 177 @implementation ReauthDialogWindowController |
178 | 178 |
179 - (id)initWithProfile:(Profile*)profile | 179 - (id)initWithProfile:(Profile*)profile |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 constrained_window_->CloseWebContentsModalDialog(); | 238 constrained_window_->CloseWebContentsModalDialog(); |
239 | 239 |
240 [super dealloc]; | 240 [super dealloc]; |
241 } | 241 } |
242 | 242 |
243 @end | 243 @end |
244 | 244 |
245 // Window controller for the User Manager view. | 245 // Window controller for the User Manager view. |
246 @interface UserManagerWindowController : NSWindowController <NSWindowDelegate> { | 246 @interface UserManagerWindowController : NSWindowController <NSWindowDelegate> { |
247 @private | 247 @private |
248 scoped_ptr<content::WebContents> webContents_; | 248 std::unique_ptr<content::WebContents> webContents_; |
249 scoped_ptr<UserManagerWebContentsDelegate> webContentsDelegate_; | 249 std::unique_ptr<UserManagerWebContentsDelegate> webContentsDelegate_; |
250 UserManagerMac* userManagerObserver_; // Weak. | 250 UserManagerMac* userManagerObserver_; // Weak. |
251 scoped_ptr<UserManagerModalManagerDelegate> modal_manager_delegate_; | 251 std::unique_ptr<UserManagerModalManagerDelegate> modal_manager_delegate_; |
252 base::scoped_nsobject<ReauthDialogWindowController> reauth_window_controller_; | 252 base::scoped_nsobject<ReauthDialogWindowController> reauth_window_controller_; |
253 } | 253 } |
254 - (void)windowWillClose:(NSNotification*)notification; | 254 - (void)windowWillClose:(NSNotification*)notification; |
255 - (void)dealloc; | 255 - (void)dealloc; |
256 - (id)initWithProfile:(Profile*)profile | 256 - (id)initWithProfile:(Profile*)profile |
257 withObserver:(UserManagerMac*)userManagerObserver; | 257 withObserver:(UserManagerMac*)userManagerObserver; |
258 - (void)showURL:(const GURL&)url; | 258 - (void)showURL:(const GURL&)url; |
259 - (void)show; | 259 - (void)show; |
260 - (void)close; | 260 - (void)close; |
261 - (BOOL)isVisible; | 261 - (BOOL)isVisible; |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 ProfileMetrics::LogTimeToOpenUserManager( | 491 ProfileMetrics::LogTimeToOpenUserManager( |
492 base::Time::Now() - user_manager_started_showing_); | 492 base::Time::Now() - user_manager_started_showing_); |
493 user_manager_started_showing_ = base::Time(); | 493 user_manager_started_showing_ = base::Time(); |
494 } | 494 } |
495 | 495 |
496 void UserManagerMac::WindowWasClosed() { | 496 void UserManagerMac::WindowWasClosed() { |
497 CloseReauthDialog(); | 497 CloseReauthDialog(); |
498 instance_ = NULL; | 498 instance_ = NULL; |
499 delete this; | 499 delete this; |
500 } | 500 } |
OLD | NEW |