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

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

Issue 2771113003: Use the same browser instance in the sync confirmation dialog. (Closed)
Patch Set: Self review Created 3 years, 9 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"
18 #include "chrome/common/url_constants.h" 19 #include "chrome/common/url_constants.h"
19 #include "components/signin/core/common/profile_management_switches.h" 20 #include "components/signin/core/common/profile_management_switches.h"
20 #include "content/public/browser/native_web_keyboard_event.h" 21 #include "content/public/browser/native_web_keyboard_event.h"
21 #include "content/public/browser/render_widget_host_view.h" 22 #include "content/public/browser/render_widget_host_view.h"
22 #include "content/public/browser/web_contents.h" 23 #include "content/public/browser/web_contents.h"
23 24
24 namespace { 25 namespace {
25 26
26 // Dimensions of the web contents containing the old-style signin flow with the 27 // Dimensions of the web contents containing the old-style signin flow with the
27 // username and password challenge on the same form. 28 // username and password challenge on the same form.
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 // static 115 // static
115 std::unique_ptr<content::WebContents> 116 std::unique_ptr<content::WebContents>
116 SigninViewControllerDelegateMac::CreateSyncConfirmationWebContents( 117 SigninViewControllerDelegateMac::CreateSyncConfirmationWebContents(
117 Profile* profile) { 118 Profile* profile) {
118 std::unique_ptr<content::WebContents> web_contents( 119 std::unique_ptr<content::WebContents> web_contents(
119 content::WebContents::Create( 120 content::WebContents::Create(
120 content::WebContents::CreateParams(profile))); 121 content::WebContents::CreateParams(profile)));
121 web_contents->GetController().LoadURL( 122 web_contents->GetController().LoadURL(
122 GURL(chrome::kChromeUISyncConfirmationURL), content::Referrer(), 123 GURL(chrome::kChromeUISyncConfirmationURL), content::Referrer(),
123 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, std::string()); 124 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);
124 128
125 NSView* webview = web_contents->GetNativeView(); 129 NSView* webview = web_contents->GetNativeView();
126 [webview setFrameSize:NSMakeSize( 130 [webview setFrameSize:NSMakeSize(
127 kModalDialogWidth, 131 kModalDialogWidth,
128 GetSyncConfirmationDialogPreferredHeight(profile))]; 132 GetSyncConfirmationDialogPreferredHeight(profile))];
129 133
130 return web_contents; 134 return web_contents;
131 } 135 }
132 136
133 // static 137 // static
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 SigninViewControllerDelegate::CreateSigninErrorDelegate( 262 SigninViewControllerDelegate::CreateSigninErrorDelegate(
259 SigninViewController* signin_view_controller, 263 SigninViewController* signin_view_controller,
260 Browser* browser) { 264 Browser* browser) {
261 return new SigninViewControllerDelegateMac( 265 return new SigninViewControllerDelegateMac(
262 signin_view_controller, 266 signin_view_controller,
263 SigninViewControllerDelegateMac::CreateSigninErrorWebContents( 267 SigninViewControllerDelegateMac::CreateSigninErrorWebContents(
264 browser->profile()), 268 browser->profile()),
265 browser, NSMakeRect(0, 0, kModalDialogWidth, kSigninErrorDialogHeight), 269 browser, NSMakeRect(0, 0, kModalDialogWidth, kSigninErrorDialogHeight),
266 ui::MODAL_TYPE_WINDOW, true /* wait_for_size */); 270 ui::MODAL_TYPE_WINDOW, true /* wait_for_size */);
267 } 271 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698