OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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.h" | 5 #include "chrome/browser/ui/views/profiles/signin_view_controller.h" |
6 | 6 |
7 #include "chrome/browser/profiles/profile.h" | 7 #include "chrome/browser/profiles/profile.h" |
8 #include "chrome/browser/profiles/profile_avatar_icon_util.h" | 8 #include "chrome/browser/profiles/profile_avatar_icon_util.h" |
9 #include "chrome/browser/signin/signin_error_controller_factory.h" | 9 #include "chrome/browser/signin/signin_error_controller_factory.h" |
10 #include "chrome/browser/signin/signin_promo.h" | 10 #include "chrome/browser/signin/signin_promo.h" |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
113 | 113 |
114 web_view->SetPreferredSize(pref_size); | 114 web_view->SetPreferredSize(pref_size); |
115 content::RenderWidgetHostView* rwhv = | 115 content::RenderWidgetHostView* rwhv = |
116 web_view->GetWebContents()->GetRenderWidgetHostView(); | 116 web_view->GetWebContents()->GetRenderWidgetHostView(); |
117 if (rwhv) | 117 if (rwhv) |
118 rwhv->SetBackgroundColor(profiles::kAvatarBubbleGaiaBackgroundColor); | 118 rwhv->SetBackgroundColor(profiles::kAvatarBubbleGaiaBackgroundColor); |
119 | 119 |
120 return web_view; | 120 return web_view; |
121 } | 121 } |
122 | 122 |
123 views::WebView* SigninViewController::CreateSyncConfirmationWebView( | |
124 Profile* profile) { | |
125 views::WebView* web_view = new views::WebView(profile); | |
126 web_view->LoadInitialURL(GURL("chrome://sync-confirmation")); | |
Roger Tawa OOO till Jul 10th
2015/12/03 20:33:45
Use kChromeUISyncConfirmationURL.
anthonyvd
2015/12/03 21:48:03
Done.
| |
127 web_view->SetPreferredSize(gfx::Size(450, 360)); | |
128 | |
129 return web_view; | |
130 } | |
131 | |
123 void SigninViewController::ShowModalSignin( | 132 void SigninViewController::ShowModalSignin( |
124 profiles::BubbleViewMode mode, Browser* browser) { | 133 profiles::BubbleViewMode mode, Browser* browser) { |
125 CloseModalSignin(); | 134 CloseModalSignin(); |
126 // The delegate will delete itself on request of the views code when the | 135 // The delegate will delete itself on request of the views code when the |
127 // widget is closed. | 136 // widget is closed. |
128 modal_signin_delegate_ = new ModalSigninDelegate( | 137 modal_signin_delegate_ = new ModalSigninDelegate( |
129 this, CreateGaiaWebView(nullptr, mode, browser->profile()), browser); | 138 this, CreateGaiaWebView(nullptr, mode, browser->profile()), browser); |
130 } | 139 } |
131 | 140 |
132 void SigninViewController::CloseModalSignin() { | 141 void SigninViewController::CloseModalSignin() { |
133 if (modal_signin_delegate_) | 142 if (modal_signin_delegate_) |
134 modal_signin_delegate_->CloseModalSignin(); | 143 modal_signin_delegate_->CloseModalSignin(); |
135 DCHECK(!modal_signin_delegate_); | 144 DCHECK(!modal_signin_delegate_); |
136 } | 145 } |
137 | 146 |
138 void SigninViewController::ResetModalSigninDelegate() { | 147 void SigninViewController::ResetModalSigninDelegate() { |
139 modal_signin_delegate_ = nullptr; | 148 modal_signin_delegate_ = nullptr; |
140 } | 149 } |
141 | 150 |
151 void SigninViewController::ShowModalSyncConfirmationDialog(Browser* browser) { | |
152 CloseModalSignin(); | |
153 modal_signin_delegate_ = new ModalSigninDelegate( | |
154 this, CreateSyncConfirmationWebView(browser->profile()), browser); | |
155 } | |
156 | |
142 // static | 157 // static |
143 bool SigninViewController::ShouldShowModalSigninForMode( | 158 bool SigninViewController::ShouldShowModalSigninForMode( |
144 profiles::BubbleViewMode mode) { | 159 profiles::BubbleViewMode mode) { |
145 return switches::UsePasswordSeparatedSigninFlow() && | 160 return switches::UsePasswordSeparatedSigninFlow() && |
146 (mode == profiles::BUBBLE_VIEW_MODE_GAIA_SIGNIN || | 161 (mode == profiles::BUBBLE_VIEW_MODE_GAIA_SIGNIN || |
147 mode == profiles::BUBBLE_VIEW_MODE_GAIA_ADD_ACCOUNT || | 162 mode == profiles::BUBBLE_VIEW_MODE_GAIA_ADD_ACCOUNT || |
148 mode == profiles::BUBBLE_VIEW_MODE_GAIA_REAUTH); | 163 mode == profiles::BUBBLE_VIEW_MODE_GAIA_REAUTH); |
149 } | 164 } |
OLD | NEW |