| 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 "components/constrained_window/constrained_window_views.h" | 15 #include "components/constrained_window/constrained_window_views.h" |
| 16 #include "components/signin/core/browser/signin_error_controller.h" | 16 #include "components/signin/core/browser/signin_error_controller.h" |
| 17 #include "components/signin/core/common/profile_management_switches.h" | 17 #include "components/signin/core/common/profile_management_switches.h" |
| 18 #include "content/public/browser/navigation_controller.h" | 18 #include "content/public/browser/navigation_controller.h" |
| 19 #include "content/public/browser/render_widget_host_view.h" | 19 #include "content/public/browser/render_widget_host_view.h" |
| 20 #include "content/public/browser/web_contents.h" | 20 #include "content/public/browser/web_contents.h" |
| 21 #include "grit/theme_resources.h" | 21 #include "grit/theme_resources.h" |
| 22 #include "ui/gfx/paint_vector_icon.h" | 22 #include "ui/gfx/paint_vector_icon.h" |
| 23 #include "ui/gfx/vector_icons.h" | 23 #include "ui/gfx/vector_icons.h" |
| 24 #include "ui/views/controls/button/image_button.h" | 24 #include "ui/views/controls/button/image_button.h" |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 bool ShouldShowCloseButton() const override { | 147 bool ShouldShowCloseButton() const override { |
| 148 return false; | 148 return false; |
| 149 } | 149 } |
| 150 | 150 |
| 151 int GetDialogButtons() const override { | 151 int GetDialogButtons() const override { |
| 152 return ui::DIALOG_BUTTON_NONE; | 152 return ui::DIALOG_BUTTON_NONE; |
| 153 } | 153 } |
| 154 | 154 |
| 155 // views::ButtonListener: | 155 // views::ButtonListener: |
| 156 void ButtonPressed(views::Button* sender, const ui::Event& event) override { | 156 void ButtonPressed(views::Button* sender, const ui::Event& event) override { |
| 157 auto auth_web_contents = InlineLoginUI::GetAuthFrameWebContents( | 157 auto auth_web_contents = signin::GetAuthFrameWebContents( |
| 158 content_view_->GetWebContents(), GURL(), "signin-frame"); | 158 content_view_->GetWebContents(), "signin-frame"); |
| 159 if (auth_web_contents) { | 159 if (auth_web_contents) { |
| 160 if (auth_web_contents->GetController().CanGoBack()) | 160 if (auth_web_contents->GetController().CanGoBack()) |
| 161 auth_web_contents->GetController().GoBack(); | 161 auth_web_contents->GetController().GoBack(); |
| 162 else | 162 else |
| 163 CloseModalSignin(); | 163 CloseModalSignin(); |
| 164 } | 164 } |
| 165 } | 165 } |
| 166 | 166 |
| 167 private: | 167 private: |
| 168 // content::WebContentsDelegate | 168 // content::WebContentsDelegate |
| 169 void LoadingStateChanged( | 169 void LoadingStateChanged( |
| 170 content::WebContents* source, bool to_different_document) override { | 170 content::WebContents* source, bool to_different_document) override { |
| 171 auto auth_web_contents = InlineLoginUI::GetAuthFrameWebContents( | 171 auto auth_web_contents = signin::GetAuthFrameWebContents( |
| 172 content_view_->GetWebContents(), GURL(), "signin-frame"); | 172 content_view_->GetWebContents(), "signin-frame"); |
| 173 if (auth_web_contents) { | 173 if (auth_web_contents) { |
| 174 if (auth_web_contents->GetController().CanGoBack()) | 174 if (auth_web_contents->GetController().CanGoBack()) |
| 175 host_view_->ShowBackArrow(); | 175 host_view_->ShowBackArrow(); |
| 176 else | 176 else |
| 177 host_view_->ShowCloseButton(); | 177 host_view_->ShowCloseButton(); |
| 178 } | 178 } |
| 179 } | 179 } |
| 180 | 180 |
| 181 views::WebView* content_view_; | 181 views::WebView* content_view_; |
| 182 HostView* host_view_; | 182 HostView* host_view_; |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 } | 245 } |
| 246 | 246 |
| 247 // static | 247 // static |
| 248 bool SigninViewController::ShouldShowModalSigninForMode( | 248 bool SigninViewController::ShouldShowModalSigninForMode( |
| 249 profiles::BubbleViewMode mode) { | 249 profiles::BubbleViewMode mode) { |
| 250 return switches::UsePasswordSeparatedSigninFlow() && | 250 return switches::UsePasswordSeparatedSigninFlow() && |
| 251 (mode == profiles::BUBBLE_VIEW_MODE_GAIA_SIGNIN || | 251 (mode == profiles::BUBBLE_VIEW_MODE_GAIA_SIGNIN || |
| 252 mode == profiles::BUBBLE_VIEW_MODE_GAIA_ADD_ACCOUNT || | 252 mode == profiles::BUBBLE_VIEW_MODE_GAIA_ADD_ACCOUNT || |
| 253 mode == profiles::BUBBLE_VIEW_MODE_GAIA_REAUTH); | 253 mode == profiles::BUBBLE_VIEW_MODE_GAIA_REAUTH); |
| 254 } | 254 } |
| OLD | NEW |