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

Side by Side Diff: chrome/browser/ui/views/profiles/signin_view_controller_delegate_views.cc

Issue 2784823002: Reland "Use the same browser instance in the sync confirmation dialog. (Closed)
Patch Set: Rebase and fix conflicts 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/views/profiles/signin_view_controller_delegate_views .h" 5 #include "chrome/browser/ui/views/profiles/signin_view_controller_delegate_views .h"
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "chrome/browser/profiles/profile.h" 8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/profiles/profile_avatar_icon_util.h" 9 #include "chrome/browser/profiles/profile_avatar_icon_util.h"
10 #include "chrome/browser/signin/signin_promo.h" 10 #include "chrome/browser/signin/signin_promo.h"
11 #include "chrome/browser/ui/browser.h" 11 #include "chrome/browser/ui/browser.h"
12 #include "chrome/browser/ui/tabs/tab_strip_model.h" 12 #include "chrome/browser/ui/tabs/tab_strip_model.h"
13 #include "chrome/browser/ui/views/frame/browser_view.h" 13 #include "chrome/browser/ui/views/frame/browser_view.h"
14 #include "chrome/browser/ui/webui/signin/sync_confirmation_ui.h"
14 #include "chrome/common/url_constants.h" 15 #include "chrome/common/url_constants.h"
15 #include "components/constrained_window/constrained_window_views.h" 16 #include "components/constrained_window/constrained_window_views.h"
16 #include "components/signin/core/common/profile_management_switches.h" 17 #include "components/signin/core/common/profile_management_switches.h"
17 #include "components/web_modal/web_contents_modal_dialog_host.h" 18 #include "components/web_modal/web_contents_modal_dialog_host.h"
18 #include "content/public/browser/render_widget_host_view.h" 19 #include "content/public/browser/render_widget_host_view.h"
19 #include "content/public/browser/web_contents.h" 20 #include "content/public/browser/web_contents.h"
20 #include "ui/views/controls/webview/webview.h" 21 #include "ui/views/controls/webview/webview.h"
21 #include "ui/views/widget/widget.h" 22 #include "ui/views/widget/widget.h"
22 23
23 namespace { 24 namespace {
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 rwhv->SetBackgroundColor(profiles::kAvatarBubbleGaiaBackgroundColor); 178 rwhv->SetBackgroundColor(profiles::kAvatarBubbleGaiaBackgroundColor);
178 179
179 return std::unique_ptr<views::WebView>(web_view); 180 return std::unique_ptr<views::WebView>(web_view);
180 } 181 }
181 182
182 std::unique_ptr<views::WebView> 183 std::unique_ptr<views::WebView>
183 SigninViewControllerDelegateViews::CreateSyncConfirmationWebView( 184 SigninViewControllerDelegateViews::CreateSyncConfirmationWebView(
184 Browser* browser) { 185 Browser* browser) {
185 views::WebView* web_view = new views::WebView(browser->profile()); 186 views::WebView* web_view = new views::WebView(browser->profile());
186 web_view->LoadInitialURL(GURL(chrome::kChromeUISyncConfirmationURL)); 187 web_view->LoadInitialURL(GURL(chrome::kChromeUISyncConfirmationURL));
187 188 SyncConfirmationUI* sync_confirmation_ui = static_cast<SyncConfirmationUI*>(
189 web_view->GetWebContents()->GetWebUI()->GetController());
190 sync_confirmation_ui->InitializeMessageHandlerWithBrowser(browser);
188 int dialog_preferred_height = 191 int dialog_preferred_height =
189 GetSyncConfirmationDialogPreferredHeight(browser->profile()); 192 GetSyncConfirmationDialogPreferredHeight(browser->profile());
190 int max_height = browser 193 int max_height = browser
191 ->window() 194 ->window()
192 ->GetWebContentsModalDialogHost() 195 ->GetWebContentsModalDialogHost()
193 ->GetMaximumDialogSize().height(); 196 ->GetMaximumDialogSize().height();
194 web_view->SetPreferredSize(gfx::Size( 197 web_view->SetPreferredSize(gfx::Size(
195 kModalDialogWidth, std::min(dialog_preferred_height, max_height))); 198 kModalDialogWidth, std::min(dialog_preferred_height, max_height)));
196 199
197 return std::unique_ptr<views::WebView>(web_view); 200 return std::unique_ptr<views::WebView>(web_view);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 240
238 SigninViewControllerDelegate* 241 SigninViewControllerDelegate*
239 SigninViewControllerDelegate::CreateSigninErrorDelegate( 242 SigninViewControllerDelegate::CreateSigninErrorDelegate(
240 SigninViewController* signin_view_controller, 243 SigninViewController* signin_view_controller,
241 Browser* browser) { 244 Browser* browser) {
242 return new SigninViewControllerDelegateViews( 245 return new SigninViewControllerDelegateViews(
243 signin_view_controller, 246 signin_view_controller,
244 SigninViewControllerDelegateViews::CreateSigninErrorWebView(browser), 247 SigninViewControllerDelegateViews::CreateSigninErrorWebView(browser),
245 browser, ui::MODAL_TYPE_WINDOW, true); 248 browser, ui::MODAL_TYPE_WINDOW, true);
246 } 249 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698