BookmarkManager: Fix 'new folder text field size changes on clicking it' issue.
[chromium-blink-merge.git] / chrome / browser / ui / cocoa / one_click_signin_dialog_controller.mm
blobf0156f2b4e7a1223aa8d4470568a967557828ed5
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #import "chrome/browser/ui/cocoa/one_click_signin_dialog_controller.h"
7 #include "base/bind.h"
8 #include "base/message_loop/message_loop.h"
9 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_sheet.h"
10 #include "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_window.h"
11 #import "chrome/browser/ui/cocoa/one_click_signin_view_controller.h"
13 OneClickSigninDialogController::OneClickSigninDialogController(
14     content::WebContents* web_contents,
15     const BrowserWindow::StartSyncCallback& sync_callback,
16     const base::string16& email) {
17   base::Closure close_callback = base::Bind(
18       &OneClickSigninDialogController::PerformClose, base::Unretained(this));
19   view_controller_.reset([[OneClickSigninViewController alloc]
20       initWithNibName:@"OneClickSigninDialog"
21           webContents:web_contents
22          syncCallback:sync_callback
23         closeCallback:close_callback
24          isSyncDialog:YES
25                 email:email
26          errorMessage:nil]);
27   base::scoped_nsobject<NSWindow> window([[ConstrainedWindowCustomWindow alloc]
28       initWithContentRect:[[view_controller_ view] bounds]]);
29   [[window contentView] addSubview:[view_controller_ view]];
31   base::scoped_nsobject<CustomConstrainedWindowSheet> sheet(
32       [[CustomConstrainedWindowSheet alloc] initWithCustomWindow:window]);
33   constrained_window_.reset(new ConstrainedWindowMac(
34       this, web_contents, sheet));
37 OneClickSigninDialogController::~OneClickSigninDialogController() {
40 void OneClickSigninDialogController::OnConstrainedWindowClosed(
41     ConstrainedWindowMac* window) {
42   [view_controller_ viewWillClose];
43   base::MessageLoop::current()->DeleteSoon(FROM_HERE, this);
46 void OneClickSigninDialogController::PerformClose() {
47   constrained_window_->CloseWebContentsModalDialog();