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

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

Issue 2632123003: Revert of MacViews: Allow the toolkit-views Enterprise Signin Confirmation Dialog to be used (Closed)
Patch Set: Created 3 years, 11 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
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 #import "chrome/browser/ui/cocoa/profiles/profile_signin_confirmation_view_contr oller.h" 5 #import "chrome/browser/ui/cocoa/profiles/profile_signin_confirmation_view_contr oller.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <cmath> 10 #include <cmath>
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 - (void)addButton:(NSButton*)button 135 - (void)addButton:(NSButton*)button
136 withTitle:(int)resourceID 136 withTitle:(int)resourceID
137 target:(id)target 137 target:(id)target
138 action:(SEL)action 138 action:(SEL)action
139 shouldAutoSize:(BOOL)shouldAutoSize; 139 shouldAutoSize:(BOOL)shouldAutoSize;
140 @end 140 @end
141 141
142 @implementation ProfileSigninConfirmationViewController 142 @implementation ProfileSigninConfirmationViewController
143 143
144 - (id)initWithBrowser:(Browser*)browser 144 - (id)initWithBrowser:(Browser*)browser
145 username:(const std::string&)username 145 username:(const std::string&)username
146 delegate: 146 delegate:(ui::ProfileSigninConfirmationDelegate*)delegate
147 (std::unique_ptr<ui::ProfileSigninConfirmationDelegate>) 147 closeDialogCallback:(const base::Closure&)closeDialogCallback
148 delegate 148 offerProfileCreation:(bool)offer {
149 closeDialogCallback:(const base::Closure&)closeDialogCallback
150 offerProfileCreation:(bool)offer {
151 if ((self = [super initWithNibName:nil bundle:nil])) { 149 if ((self = [super initWithNibName:nil bundle:nil])) {
152 browser_ = browser; 150 browser_ = browser;
153 username_ = username; 151 username_ = username;
154 delegate_ = std::move(delegate); 152 delegate_ = delegate;
155 closeDialogCallback_ = closeDialogCallback; 153 closeDialogCallback_ = closeDialogCallback;
156 offerProfileCreation_ = offer; 154 offerProfileCreation_ = offer;
157 } 155 }
158 return self; 156 return self;
159 } 157 }
160 158
161 - (void)loadView { 159 - (void)loadView {
162 self.view = [[[NSView alloc] initWithFrame:NSZeroRect] autorelease]; 160 self.view = [[[NSView alloc] initWithFrame:NSZeroRect] autorelease];
163 cancelButton_.reset( 161 cancelButton_.reset(
164 [[ConstrainedWindowButton alloc] initWithFrame:NSZeroRect]); 162 [[ConstrainedWindowButton alloc] initWithFrame:NSZeroRect]);
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 dialogWidth - chrome_style::kCloseButtonPadding - 369 dialogWidth - chrome_style::kCloseButtonPadding -
372 NSWidth(closeButtonFrame), 370 NSWidth(closeButtonFrame),
373 dialogHeight - chrome_style::kCloseButtonPadding - 371 dialogHeight - chrome_style::kCloseButtonPadding -
374 NSWidth(closeButtonFrame)); 372 NSWidth(closeButtonFrame));
375 [closeButton_ setFrameOrigin:closeOrigin]; 373 [closeButton_ setFrameOrigin:closeOrigin];
376 } 374 }
377 375
378 - (IBAction)cancel:(id)sender { 376 - (IBAction)cancel:(id)sender {
379 if (delegate_) { 377 if (delegate_) {
380 delegate_->OnCancelSignin(); 378 delegate_->OnCancelSignin();
381 delegate_ = nullptr; 379 delegate_ = NULL;
382 closeDialogCallback_.Run(); 380 closeDialogCallback_.Run();
383 } 381 }
384 } 382 }
385 383
386 - (IBAction)ok:(id)sender { 384 - (IBAction)ok:(id)sender {
387 if (delegate_) { 385 if (delegate_) {
388 delegate_->OnContinueSignin(); 386 delegate_->OnContinueSignin();
389 delegate_ = nullptr; 387 delegate_ = NULL;
390 closeDialogCallback_.Run(); 388 closeDialogCallback_.Run();
391 } 389 }
392 } 390 }
393 391
394 - (IBAction)close:(id)sender { 392 - (IBAction)close:(id)sender {
395 if (delegate_) { 393 if (delegate_) {
396 delegate_->OnCancelSignin(); 394 delegate_->OnCancelSignin();
397 delegate_ = nullptr; 395 delegate_ = NULL;
398 } 396 }
399 closeDialogCallback_.Run(); 397 closeDialogCallback_.Run();
400 } 398 }
401 399
402 - (IBAction)createProfile:(id)sender { 400 - (IBAction)createProfile:(id)sender {
403 if (delegate_) { 401 if (delegate_) {
404 delegate_->OnSigninWithNewProfile(); 402 delegate_->OnSigninWithNewProfile();
405 delegate_ = nullptr; 403 delegate_ = NULL;
406 closeDialogCallback_.Run(); 404 closeDialogCallback_.Run();
407 } 405 }
408 } 406 }
409 407
410 - (void)learnMore { 408 - (void)learnMore {
411 chrome::NavigateParams params( 409 chrome::NavigateParams params(
412 browser_, GURL(chrome::kChromeEnterpriseSignInLearnMoreURL), 410 browser_, GURL(chrome::kChromeEnterpriseSignInLearnMoreURL),
413 ui::PAGE_TRANSITION_AUTO_TOPLEVEL); 411 ui::PAGE_TRANSITION_AUTO_TOPLEVEL);
414 params.disposition = WindowOpenDisposition::NEW_POPUP; 412 params.disposition = WindowOpenDisposition::NEW_POPUP;
415 params.window_action = chrome::NavigateParams::SHOW_WINDOW; 413 params.window_action = chrome::NavigateParams::SHOW_WINDOW;
(...skipping 19 matching lines...) Expand all
435 [button setTitle:base::SysUTF16ToNSString( 433 [button setTitle:base::SysUTF16ToNSString(
436 l10n_util::GetStringUTF16(resourceID))]; 434 l10n_util::GetStringUTF16(resourceID))];
437 [button setTarget:target]; 435 [button setTarget:target];
438 [button setAction:action]; 436 [button setAction:action];
439 [[self view] addSubview:button]; 437 [[self view] addSubview:button];
440 if (shouldAutoSize) 438 if (shouldAutoSize)
441 [GTMUILocalizerAndLayoutTweaker sizeToFitView:button]; 439 [GTMUILocalizerAndLayoutTweaker sizeToFitView:button];
442 } 440 }
443 441
444 @end 442 @end
443
444 @implementation ProfileSigninConfirmationViewController (TestingAPI)
445
446 - (ui::ProfileSigninConfirmationDelegate*)delegate {
447 return delegate_;
448 }
449
450 - (NSButton*)createProfileButton {
451 return createProfileButton_.get();
452 }
453
454 - (NSTextView*)explanationField {
455 return explanationField_.get();
456 }
457
458 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698