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

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

Issue 2787453002: Revert of Use the same browser instance in the sync confirmation dialog. (Closed)
Patch Set: Created 3 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #include "chrome/browser/ui/cocoa/profiles/signin_view_controller_delegate_mac.h " 5 #include "chrome/browser/ui/cocoa/profiles/signin_view_controller_delegate_mac.h "
6 6
7 #import <Cocoa/Cocoa.h> 7 #import <Cocoa/Cocoa.h>
8 8
9 #include "chrome/app/chrome_command_ids.h" 9 #include "chrome/app/chrome_command_ids.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
11 #include "chrome/browser/profiles/profile_avatar_icon_util.h" 11 #include "chrome/browser/profiles/profile_avatar_icon_util.h"
12 #include "chrome/browser/signin/signin_promo.h" 12 #include "chrome/browser/signin/signin_promo.h"
13 #include "chrome/browser/ui/browser.h" 13 #include "chrome/browser/ui/browser.h"
14 #import "chrome/browser/ui/cocoa/browser_window_utils.h" 14 #import "chrome/browser/ui/cocoa/browser_window_utils.h"
15 #include "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_s heet.h" 15 #include "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_s heet.h"
16 #include "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_w indow.h" 16 #include "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_w indow.h"
17 #include "chrome/browser/ui/tabs/tab_strip_model.h" 17 #include "chrome/browser/ui/tabs/tab_strip_model.h"
18 #include "chrome/browser/ui/webui/signin/sync_confirmation_ui.h"
19 #include "chrome/common/url_constants.h" 18 #include "chrome/common/url_constants.h"
20 #include "components/signin/core/common/profile_management_switches.h" 19 #include "components/signin/core/common/profile_management_switches.h"
21 #include "content/public/browser/native_web_keyboard_event.h" 20 #include "content/public/browser/native_web_keyboard_event.h"
22 #include "content/public/browser/render_widget_host_view.h" 21 #include "content/public/browser/render_widget_host_view.h"
23 #include "content/public/browser/web_contents.h" 22 #include "content/public/browser/web_contents.h"
24 23
25 namespace { 24 namespace {
26 25
27 // Dimensions of the web contents containing the old-style signin flow with the 26 // Dimensions of the web contents containing the old-style signin flow with the
28 // username and password challenge on the same form. 27 // username and password challenge on the same form.
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 content::RenderWidgetHostView* rwhv = web_contents->GetRenderWidgetHostView(); 107 content::RenderWidgetHostView* rwhv = web_contents->GetRenderWidgetHostView();
109 if (rwhv) 108 if (rwhv)
110 rwhv->SetBackgroundColor(profiles::kAvatarBubbleGaiaBackgroundColor); 109 rwhv->SetBackgroundColor(profiles::kAvatarBubbleGaiaBackgroundColor);
111 110
112 return web_contents; 111 return web_contents;
113 } 112 }
114 113
115 // static 114 // static
116 std::unique_ptr<content::WebContents> 115 std::unique_ptr<content::WebContents>
117 SigninViewControllerDelegateMac::CreateSyncConfirmationWebContents( 116 SigninViewControllerDelegateMac::CreateSyncConfirmationWebContents(
118 Browser* browser) { 117 Profile* profile) {
119 std::unique_ptr<content::WebContents> web_contents( 118 std::unique_ptr<content::WebContents> web_contents(
120 content::WebContents::Create( 119 content::WebContents::Create(
121 content::WebContents::CreateParams(browser->profile()))); 120 content::WebContents::CreateParams(profile)));
122 web_contents->GetController().LoadURL( 121 web_contents->GetController().LoadURL(
123 GURL(chrome::kChromeUISyncConfirmationURL), content::Referrer(), 122 GURL(chrome::kChromeUISyncConfirmationURL), content::Referrer(),
124 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, std::string()); 123 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, std::string());
125 SyncConfirmationUI* sync_confirmation_ui = static_cast<SyncConfirmationUI*>(
126 web_contents->GetWebUI()->GetController());
127 sync_confirmation_ui->InitializeMessageHandlerWithBrowser(browser);
128 124
129 NSView* webview = web_contents->GetNativeView(); 125 NSView* webview = web_contents->GetNativeView();
130 [webview setFrameSize:NSMakeSize(kModalDialogWidth, 126 [webview setFrameSize:NSMakeSize(
131 GetSyncConfirmationDialogPreferredHeight( 127 kModalDialogWidth,
132 browser->profile()))]; 128 GetSyncConfirmationDialogPreferredHeight(profile))];
133 129
134 return web_contents; 130 return web_contents;
135 } 131 }
136 132
137 // static 133 // static
138 std::unique_ptr<content::WebContents> 134 std::unique_ptr<content::WebContents>
139 SigninViewControllerDelegateMac::CreateSigninErrorWebContents( 135 SigninViewControllerDelegateMac::CreateSigninErrorWebContents(
140 Profile* profile) { 136 Profile* profile) {
141 std::unique_ptr<content::WebContents> web_contents( 137 std::unique_ptr<content::WebContents> web_contents(
142 content::WebContents::Create( 138 content::WebContents::Create(
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 } 239 }
244 240
245 // static 241 // static
246 SigninViewControllerDelegate* 242 SigninViewControllerDelegate*
247 SigninViewControllerDelegate::CreateSyncConfirmationDelegate( 243 SigninViewControllerDelegate::CreateSyncConfirmationDelegate(
248 SigninViewController* signin_view_controller, 244 SigninViewController* signin_view_controller,
249 Browser* browser) { 245 Browser* browser) {
250 return new SigninViewControllerDelegateMac( 246 return new SigninViewControllerDelegateMac(
251 signin_view_controller, 247 signin_view_controller,
252 SigninViewControllerDelegateMac::CreateSyncConfirmationWebContents( 248 SigninViewControllerDelegateMac::CreateSyncConfirmationWebContents(
253 browser), 249 browser->profile()),
254 browser, 250 browser,
255 NSMakeRect(0, 0, kModalDialogWidth, 251 NSMakeRect(0, 0, kModalDialogWidth,
256 GetSyncConfirmationDialogPreferredHeight(browser->profile())), 252 GetSyncConfirmationDialogPreferredHeight(browser->profile())),
257 ui::MODAL_TYPE_WINDOW, true /* wait_for_size */); 253 ui::MODAL_TYPE_WINDOW, true /* wait_for_size */);
258 } 254 }
259 255
260 // static 256 // static
261 SigninViewControllerDelegate* 257 SigninViewControllerDelegate*
262 SigninViewControllerDelegate::CreateSigninErrorDelegate( 258 SigninViewControllerDelegate::CreateSigninErrorDelegate(
263 SigninViewController* signin_view_controller, 259 SigninViewController* signin_view_controller,
264 Browser* browser) { 260 Browser* browser) {
265 return new SigninViewControllerDelegateMac( 261 return new SigninViewControllerDelegateMac(
266 signin_view_controller, 262 signin_view_controller,
267 SigninViewControllerDelegateMac::CreateSigninErrorWebContents( 263 SigninViewControllerDelegateMac::CreateSigninErrorWebContents(
268 browser->profile()), 264 browser->profile()),
269 browser, NSMakeRect(0, 0, kModalDialogWidth, kSigninErrorDialogHeight), 265 browser, NSMakeRect(0, 0, kModalDialogWidth, kSigninErrorDialogHeight),
270 ui::MODAL_TYPE_WINDOW, true /* wait_for_size */); 266 ui::MODAL_TYPE_WINDOW, true /* wait_for_size */);
271 } 267 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698