| 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 #import "chrome/browser/ui/cocoa/profiles/profile_signin_confirmation_dialog_coc
oa.h" | 5 #import "chrome/browser/ui/cocoa/profiles/profile_signin_confirmation_dialog_coc
oa.h" |
| 6 | 6 |
| 7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
| 8 #include "chrome/browser/ui/browser.h" | 8 #include "chrome/browser/ui/browser.h" |
| 9 #include "chrome/browser/ui/browser_finder.h" | 9 #include "chrome/browser/ui/browser_finder.h" |
| 10 #include "chrome/browser/ui/browser_window.h" | 10 #include "chrome/browser/ui/browser_window.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 delegate:delegate | 52 delegate:delegate |
| 53 closeDialogCallback:closeDialogCallback | 53 closeDialogCallback:closeDialogCallback |
| 54 offerProfileCreation:offer_profile_creation]); | 54 offerProfileCreation:offer_profile_creation]); |
| 55 | 55 |
| 56 // Setup the constrained window that will show the view. | 56 // Setup the constrained window that will show the view. |
| 57 base::scoped_nsobject<NSWindow> window([[ConstrainedWindowCustomWindow alloc] | 57 base::scoped_nsobject<NSWindow> window([[ConstrainedWindowCustomWindow alloc] |
| 58 initWithContentRect:[[controller_ view] bounds]]); | 58 initWithContentRect:[[controller_ view] bounds]]); |
| 59 [[window contentView] addSubview:[controller_ view]]; | 59 [[window contentView] addSubview:[controller_ view]]; |
| 60 base::scoped_nsobject<CustomConstrainedWindowSheet> sheet( | 60 base::scoped_nsobject<CustomConstrainedWindowSheet> sheet( |
| 61 [[CustomConstrainedWindowSheet alloc] initWithCustomWindow:window]); | 61 [[CustomConstrainedWindowSheet alloc] initWithCustomWindow:window]); |
| 62 window_.reset(new ConstrainedWindowMac(this, web_contents, sheet)); | 62 window_ = CreateAndShowWebModalDialogMac(this, web_contents, sheet); |
| 63 } | 63 } |
| 64 | 64 |
| 65 ProfileSigninConfirmationDialogCocoa::~ProfileSigninConfirmationDialogCocoa() { | 65 ProfileSigninConfirmationDialogCocoa::~ProfileSigninConfirmationDialogCocoa() { |
| 66 } | 66 } |
| 67 | 67 |
| 68 // static | 68 // static |
| 69 void ProfileSigninConfirmationDialogCocoa::Show( | 69 void ProfileSigninConfirmationDialogCocoa::Show( |
| 70 Browser* browser, | 70 Browser* browser, |
| 71 content::WebContents* web_contents, | 71 content::WebContents* web_contents, |
| 72 Profile* profile, | 72 Profile* profile, |
| 73 const std::string& username, | 73 const std::string& username, |
| 74 ui::ProfileSigninConfirmationDelegate* delegate) { | 74 ui::ProfileSigninConfirmationDelegate* delegate) { |
| 75 ui::CheckShouldPromptForNewProfile( | 75 ui::CheckShouldPromptForNewProfile( |
| 76 profile, base::Bind(ShowDialog, browser, web_contents, profile, username, | 76 profile, base::Bind(ShowDialog, browser, web_contents, profile, username, |
| 77 delegate)); | 77 delegate)); |
| 78 } | 78 } |
| 79 | 79 |
| 80 void ProfileSigninConfirmationDialogCocoa::Close() { | 80 void ProfileSigninConfirmationDialogCocoa::Close() { |
| 81 window_->CloseWebContentsModalDialog(); | 81 window_->CloseWebContentsModalDialog(); |
| 82 } | 82 } |
| 83 | 83 |
| 84 void ProfileSigninConfirmationDialogCocoa::OnConstrainedWindowClosed( | 84 void ProfileSigninConfirmationDialogCocoa::OnConstrainedWindowClosed( |
| 85 ConstrainedWindowMac* window) { | 85 ConstrainedWindowMac* window) { |
| 86 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this); | 86 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this); |
| 87 } | 87 } |
| OLD | NEW |