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

Side by Side Diff: chrome/browser/ui/cocoa/one_click_signin_dialog_controller.mm

Issue 13845022: Mac: Display a native bubble (instead of the JS one) after the web signin flow. (branched from http… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ntpBubble
Patch Set: Ditto Created 7 years, 7 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 (c) 2013 The Chromium Authors. All rights reserved. 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 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/one_click_signin_dialog_controller.h" 5 #import "chrome/browser/ui/cocoa/one_click_signin_dialog_controller.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_sh eet.h" 9 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_sh eet.h"
10 #include "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_w indow.h" 10 #include "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_w indow.h"
11 #import "chrome/browser/ui/cocoa/one_click_signin_view_controller.h" 11 #import "chrome/browser/ui/cocoa/one_click_signin_view_controller.h"
12 12
13 OneClickSigninDialogController::OneClickSigninDialogController( 13 OneClickSigninDialogController::OneClickSigninDialogController(
14 content::WebContents* web_contents, 14 content::WebContents* web_contents,
15 const BrowserWindow::StartSyncCallback& sync_callback) { 15 const BrowserWindow::StartSyncCallback& sync_callback) {
16 base::Closure close_callback = base::Bind( 16 base::Closure close_callback = base::Bind(
17 &OneClickSigninDialogController::PerformClose, base::Unretained(this)); 17 &OneClickSigninDialogController::PerformClose, base::Unretained(this));
18 view_controller_.reset([[OneClickSigninViewController alloc] 18 view_controller_.reset([[OneClickSigninViewController alloc]
19 initWithNibName:@"OneClickSigninDialog" 19 initWithNibName:@"OneClickSigninDialog"
20 webContents:web_contents 20 webContents:web_contents
21 syncCallback:sync_callback 21 syncCallback:sync_callback
22 closeCallback:close_callback 22 closeCallback:close_callback
23 isModalDialog:YES]); 23 isSyncDialog:YES
24 errorMessage:nil]);
24 scoped_nsobject<NSWindow> window([[ConstrainedWindowCustomWindow alloc] 25 scoped_nsobject<NSWindow> window([[ConstrainedWindowCustomWindow alloc]
25 initWithContentRect:[[view_controller_ view] bounds]]); 26 initWithContentRect:[[view_controller_ view] bounds]]);
26 [[window contentView] addSubview:[view_controller_ view]]; 27 [[window contentView] addSubview:[view_controller_ view]];
27 28
28 scoped_nsobject<CustomConstrainedWindowSheet> sheet( 29 scoped_nsobject<CustomConstrainedWindowSheet> sheet(
29 [[CustomConstrainedWindowSheet alloc] 30 [[CustomConstrainedWindowSheet alloc]
30 initWithCustomWindow:window]); 31 initWithCustomWindow:window]);
31 constrained_window_.reset(new ConstrainedWindowMac( 32 constrained_window_.reset(new ConstrainedWindowMac(
32 this, web_contents, sheet)); 33 this, web_contents, sheet));
33 } 34 }
34 35
35 OneClickSigninDialogController::~OneClickSigninDialogController() { 36 OneClickSigninDialogController::~OneClickSigninDialogController() {
36 } 37 }
37 38
38 void OneClickSigninDialogController::OnConstrainedWindowClosed( 39 void OneClickSigninDialogController::OnConstrainedWindowClosed(
39 ConstrainedWindowMac* window) { 40 ConstrainedWindowMac* window) {
40 [view_controller_ viewWillClose]; 41 [view_controller_ viewWillClose];
41 MessageLoop::current()->DeleteSoon(FROM_HERE, this); 42 MessageLoop::current()->DeleteSoon(FROM_HERE, this);
42 } 43 }
43 44
44 void OneClickSigninDialogController::PerformClose() { 45 void OneClickSigninDialogController::PerformClose() {
45 constrained_window_->CloseWebContentsModalDialog(); 46 constrained_window_->CloseWebContentsModalDialog();
46 } 47 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698