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

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: Fix bot issues Created 7 years, 8 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 isSyncDialog:true
24 errorMessage:string16()]);
23 scoped_nsobject<NSWindow> window([[ConstrainedWindowCustomWindow alloc] 25 scoped_nsobject<NSWindow> window([[ConstrainedWindowCustomWindow alloc]
24 initWithContentRect:[[view_controller_ view] bounds]]); 26 initWithContentRect:[[view_controller_ view] bounds]]);
25 [[window contentView] addSubview:[view_controller_ view]]; 27 [[window contentView] addSubview:[view_controller_ view]];
26 28
27 scoped_nsobject<CustomConstrainedWindowSheet> sheet( 29 scoped_nsobject<CustomConstrainedWindowSheet> sheet(
28 [[CustomConstrainedWindowSheet alloc] 30 [[CustomConstrainedWindowSheet alloc]
29 initWithCustomWindow:window]); 31 initWithCustomWindow:window]);
30 constrained_window_.reset(new ConstrainedWindowMac( 32 constrained_window_.reset(new ConstrainedWindowMac(
31 this, web_contents, sheet)); 33 this, web_contents, sheet));
32 } 34 }
33 35
34 OneClickSigninDialogController::~OneClickSigninDialogController() { 36 OneClickSigninDialogController::~OneClickSigninDialogController() {
35 } 37 }
36 38
37 void OneClickSigninDialogController::OnConstrainedWindowClosed( 39 void OneClickSigninDialogController::OnConstrainedWindowClosed(
38 ConstrainedWindowMac* window) { 40 ConstrainedWindowMac* window) {
39 [view_controller_ viewWillClose]; 41 [view_controller_ viewWillClose];
40 MessageLoop::current()->DeleteSoon(FROM_HERE, this); 42 MessageLoop::current()->DeleteSoon(FROM_HERE, this);
41 } 43 }
42 44
43 void OneClickSigninDialogController::PerformClose() { 45 void OneClickSigninDialogController::PerformClose() {
44 constrained_window_->CloseWebContentsModalDialog(); 46 constrained_window_->CloseWebContentsModalDialog();
45 } 47 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698