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 "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_error_controller_factory.h" | 10 #include "chrome/browser/signin/signin_error_controller_factory.h" |
11 #include "chrome/browser/signin/signin_promo.h" | 11 #include "chrome/browser/signin/signin_promo.h" |
12 #include "chrome/browser/ui/browser.h" | 12 #include "chrome/browser/ui/browser.h" |
13 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 13 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
14 #include "chrome/browser/ui/webui/signin/inline_login_ui.h" | 14 #include "chrome/browser/ui/webui/signin/get_auth_frame.h" |
15 #include "chrome/common/url_constants.h" | 15 #include "chrome/common/url_constants.h" |
16 #include "components/constrained_window/constrained_window_views.h" | 16 #include "components/constrained_window/constrained_window_views.h" |
17 #include "components/signin/core/browser/signin_error_controller.h" | 17 #include "components/signin/core/browser/signin_error_controller.h" |
18 #include "components/signin/core/common/profile_management_switches.h" | 18 #include "components/signin/core/common/profile_management_switches.h" |
19 #include "content/public/browser/navigation_controller.h" | 19 #include "content/public/browser/navigation_controller.h" |
20 #include "content/public/browser/render_widget_host_view.h" | 20 #include "content/public/browser/render_widget_host_view.h" |
21 #include "content/public/browser/web_contents.h" | 21 #include "content/public/browser/web_contents.h" |
22 #include "grit/theme_resources.h" | 22 #include "grit/theme_resources.h" |
23 #include "ui/gfx/paint_vector_icon.h" | 23 #include "ui/gfx/paint_vector_icon.h" |
24 #include "ui/gfx/vector_icons.h" | 24 #include "ui/gfx/vector_icons.h" |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 bool ShouldShowCloseButton() const override { | 150 bool ShouldShowCloseButton() const override { |
151 return false; | 151 return false; |
152 } | 152 } |
153 | 153 |
154 int GetDialogButtons() const override { | 154 int GetDialogButtons() const override { |
155 return ui::DIALOG_BUTTON_NONE; | 155 return ui::DIALOG_BUTTON_NONE; |
156 } | 156 } |
157 | 157 |
158 // views::ButtonListener: | 158 // views::ButtonListener: |
159 void ButtonPressed(views::Button* sender, const ui::Event& event) override { | 159 void ButtonPressed(views::Button* sender, const ui::Event& event) override { |
160 auto auth_web_contents = InlineLoginUI::GetAuthFrameWebContents( | 160 auto auth_web_contents = signin::GetAuthFrameWebContents( |
161 content_view_->GetWebContents(), GURL(), "signin-frame"); | 161 content_view_->GetWebContents(), "signin-frame"); |
162 if (auth_web_contents) { | 162 if (auth_web_contents) { |
163 if (auth_web_contents->GetController().CanGoBack()) | 163 if (auth_web_contents->GetController().CanGoBack()) |
164 auth_web_contents->GetController().GoBack(); | 164 auth_web_contents->GetController().GoBack(); |
165 else | 165 else |
166 CloseModalSignin(); | 166 CloseModalSignin(); |
167 } | 167 } |
168 } | 168 } |
169 | 169 |
170 private: | 170 private: |
171 // content::WebContentsDelegate | 171 // content::WebContentsDelegate |
172 void LoadingStateChanged( | 172 void LoadingStateChanged( |
173 content::WebContents* source, bool to_different_document) override { | 173 content::WebContents* source, bool to_different_document) override { |
174 auto auth_web_contents = InlineLoginUI::GetAuthFrameWebContents( | 174 auto auth_web_contents = signin::GetAuthFrameWebContents( |
175 content_view_->GetWebContents(), GURL(), "signin-frame"); | 175 content_view_->GetWebContents(), "signin-frame"); |
176 if (auth_web_contents) { | 176 if (auth_web_contents) { |
177 if (auth_web_contents->GetController().CanGoBack()) | 177 if (auth_web_contents->GetController().CanGoBack()) |
178 host_view_->ShowBackArrow(); | 178 host_view_->ShowBackArrow(); |
179 else | 179 else |
180 host_view_->ShowCloseButton(); | 180 host_view_->ShowCloseButton(); |
181 } | 181 } |
182 } | 182 } |
183 | 183 |
184 views::WebView* content_view_; | 184 views::WebView* content_view_; |
185 HostView* host_view_; | 185 HostView* host_view_; |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 } | 264 } |
265 | 265 |
266 // static | 266 // static |
267 bool SigninViewController::ShouldShowModalSigninForMode( | 267 bool SigninViewController::ShouldShowModalSigninForMode( |
268 profiles::BubbleViewMode mode) { | 268 profiles::BubbleViewMode mode) { |
269 return switches::UsePasswordSeparatedSigninFlow() && | 269 return switches::UsePasswordSeparatedSigninFlow() && |
270 (mode == profiles::BUBBLE_VIEW_MODE_GAIA_SIGNIN || | 270 (mode == profiles::BUBBLE_VIEW_MODE_GAIA_SIGNIN || |
271 mode == profiles::BUBBLE_VIEW_MODE_GAIA_ADD_ACCOUNT || | 271 mode == profiles::BUBBLE_VIEW_MODE_GAIA_ADD_ACCOUNT || |
272 mode == profiles::BUBBLE_VIEW_MODE_GAIA_REAUTH); | 272 mode == profiles::BUBBLE_VIEW_MODE_GAIA_REAUTH); |
273 } | 273 } |
OLD | NEW |