| OLD | NEW |
| 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" | |
| 15 #include "chrome/common/url_constants.h" | 14 #include "chrome/common/url_constants.h" |
| 16 #include "components/constrained_window/constrained_window_views.h" | 15 #include "components/constrained_window/constrained_window_views.h" |
| 17 #include "components/signin/core/common/profile_management_switches.h" | 16 #include "components/signin/core/common/profile_management_switches.h" |
| 18 #include "components/web_modal/web_contents_modal_dialog_host.h" | 17 #include "components/web_modal/web_contents_modal_dialog_host.h" |
| 19 #include "content/public/browser/render_widget_host_view.h" | 18 #include "content/public/browser/render_widget_host_view.h" |
| 20 #include "content/public/browser/web_contents.h" | 19 #include "content/public/browser/web_contents.h" |
| 21 #include "ui/views/controls/webview/webview.h" | 20 #include "ui/views/controls/webview/webview.h" |
| 22 #include "ui/views/widget/widget.h" | 21 #include "ui/views/widget/widget.h" |
| 23 | 22 |
| 24 namespace { | 23 namespace { |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 rwhv->SetBackgroundColor(profiles::kAvatarBubbleGaiaBackgroundColor); | 177 rwhv->SetBackgroundColor(profiles::kAvatarBubbleGaiaBackgroundColor); |
| 179 | 178 |
| 180 return std::unique_ptr<views::WebView>(web_view); | 179 return std::unique_ptr<views::WebView>(web_view); |
| 181 } | 180 } |
| 182 | 181 |
| 183 std::unique_ptr<views::WebView> | 182 std::unique_ptr<views::WebView> |
| 184 SigninViewControllerDelegateViews::CreateSyncConfirmationWebView( | 183 SigninViewControllerDelegateViews::CreateSyncConfirmationWebView( |
| 185 Browser* browser) { | 184 Browser* browser) { |
| 186 views::WebView* web_view = new views::WebView(browser->profile()); | 185 views::WebView* web_view = new views::WebView(browser->profile()); |
| 187 web_view->LoadInitialURL(GURL(chrome::kChromeUISyncConfirmationURL)); | 186 web_view->LoadInitialURL(GURL(chrome::kChromeUISyncConfirmationURL)); |
| 188 SyncConfirmationUI* sync_confirmation_ui = static_cast<SyncConfirmationUI*>( | 187 |
| 189 web_view->GetWebContents()->GetWebUI()->GetController()); | |
| 190 sync_confirmation_ui->InitializeMessageHandlerWithBrowser(browser); | |
| 191 int dialog_preferred_height = | 188 int dialog_preferred_height = |
| 192 GetSyncConfirmationDialogPreferredHeight(browser->profile()); | 189 GetSyncConfirmationDialogPreferredHeight(browser->profile()); |
| 193 int max_height = browser | 190 int max_height = browser |
| 194 ->window() | 191 ->window() |
| 195 ->GetWebContentsModalDialogHost() | 192 ->GetWebContentsModalDialogHost() |
| 196 ->GetMaximumDialogSize().height(); | 193 ->GetMaximumDialogSize().height(); |
| 197 web_view->SetPreferredSize(gfx::Size( | 194 web_view->SetPreferredSize(gfx::Size( |
| 198 kModalDialogWidth, std::min(dialog_preferred_height, max_height))); | 195 kModalDialogWidth, std::min(dialog_preferred_height, max_height))); |
| 199 | 196 |
| 200 return std::unique_ptr<views::WebView>(web_view); | 197 return std::unique_ptr<views::WebView>(web_view); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 | 237 |
| 241 SigninViewControllerDelegate* | 238 SigninViewControllerDelegate* |
| 242 SigninViewControllerDelegate::CreateSigninErrorDelegate( | 239 SigninViewControllerDelegate::CreateSigninErrorDelegate( |
| 243 SigninViewController* signin_view_controller, | 240 SigninViewController* signin_view_controller, |
| 244 Browser* browser) { | 241 Browser* browser) { |
| 245 return new SigninViewControllerDelegateViews( | 242 return new SigninViewControllerDelegateViews( |
| 246 signin_view_controller, | 243 signin_view_controller, |
| 247 SigninViewControllerDelegateViews::CreateSigninErrorWebView(browser), | 244 SigninViewControllerDelegateViews::CreateSigninErrorWebView(browser), |
| 248 browser, ui::MODAL_TYPE_WINDOW, true); | 245 browser, ui::MODAL_TYPE_WINDOW, true); |
| 249 } | 246 } |
| OLD | NEW |