| 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 #ifndef CHROME_BROWSER_UI_VIEWS_PROFILES_SIGNIN_VIEW_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_PROFILES_SIGNIN_VIEW_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_PROFILES_SIGNIN_VIEW_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_PROFILES_SIGNIN_VIEW_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/observer_list.h" | 9 #include "base/observer_list.h" |
| 10 #include "chrome/browser/ui/profile_chooser_constants.h" | 10 #include "chrome/browser/ui/profile_chooser_constants.h" |
| 11 | 11 |
| 12 class Browser; | 12 class Browser; |
| 13 class ModalSigninDelegate; | 13 class ModalSigninDelegate; |
| 14 class Profile; | 14 class Profile; |
| 15 | 15 |
| 16 namespace content { | 16 namespace content { |
| 17 class WebContentsDelegate; | 17 class WebContentsDelegate; |
| 18 } | 18 } |
| 19 | 19 |
| 20 namespace signin_metrics { |
| 21 enum class AccessPoint; |
| 22 } |
| 23 |
| 20 namespace views { | 24 namespace views { |
| 21 class WebView; | 25 class WebView; |
| 22 } | 26 } |
| 23 | 27 |
| 24 class SigninViewController { | 28 class SigninViewController { |
| 25 public: | 29 public: |
| 26 SigninViewController(); | 30 SigninViewController(); |
| 27 ~SigninViewController(); | 31 ~SigninViewController(); |
| 28 | 32 |
| 29 // Returns true if the signin flow should be shown as tab-modal for |mode|. | 33 // Returns true if the signin flow should be shown as tab-modal for |mode|. |
| 30 static bool ShouldShowModalSigninForMode(profiles::BubbleViewMode mode); | 34 static bool ShouldShowModalSigninForMode(profiles::BubbleViewMode mode); |
| 31 | 35 |
| 32 // Creates the web view that contains the signin flow in |mode| using | 36 // Creates the web view that contains the signin flow in |mode| using |
| 33 // |profile| as the web content's profile, then sets |delegate| as the created | 37 // |profile| as the web content's profile, then sets |delegate| as the created |
| 34 // web content's delegate. | 38 // web content's delegate. |
| 35 static views::WebView* CreateGaiaWebView( | 39 static views::WebView* CreateGaiaWebView( |
| 36 content::WebContentsDelegate* delegate, | 40 content::WebContentsDelegate* delegate, |
| 37 profiles::BubbleViewMode mode, | 41 profiles::BubbleViewMode mode, |
| 38 Profile* profile); | 42 Profile* profile, |
| 43 signin_metrics::AccessPoint access_point); |
| 39 | 44 |
| 40 // Shows the signin flow as a tab modal dialog attached to |browser|'s active | 45 // Shows the signin flow as a tab modal dialog attached to |browser|'s active |
| 41 // web contents. | 46 // web contents. |
| 42 void ShowModalSignin(profiles::BubbleViewMode mode, Browser* browser); | 47 // |access_point| indicates the access point used to open the Gaia sign in |
| 48 // page. |
| 49 void ShowModalSignin(profiles::BubbleViewMode mode, |
| 50 Browser* browser, |
| 51 signin_metrics::AccessPoint access_point); |
| 43 | 52 |
| 44 // Closes the tab-modal signin flow previously shown using this | 53 // Closes the tab-modal signin flow previously shown using this |
| 45 // SigninViewController, if one exists. Does nothing otherwise. | 54 // SigninViewController, if one exists. Does nothing otherwise. |
| 46 void CloseModalSignin(); | 55 void CloseModalSignin(); |
| 47 | 56 |
| 48 // Notifies this object that it's |modal_signin_delegate_| member has become | 57 // Notifies this object that it's |modal_signin_delegate_| member has become |
| 49 // invalid. | 58 // invalid. |
| 50 void ResetModalSigninDelegate(); | 59 void ResetModalSigninDelegate(); |
| 51 | 60 |
| 52 private: | 61 private: |
| 53 ModalSigninDelegate* modal_signin_delegate_; | 62 ModalSigninDelegate* modal_signin_delegate_; |
| 54 | 63 |
| 55 DISALLOW_COPY_AND_ASSIGN(SigninViewController); | 64 DISALLOW_COPY_AND_ASSIGN(SigninViewController); |
| 56 }; | 65 }; |
| 57 | 66 |
| 58 #endif // CHROME_BROWSER_UI_VIEWS_PROFILES_SIGNIN_VIEW_CONTROLLER_H_ | 67 #endif // CHROME_BROWSER_UI_VIEWS_PROFILES_SIGNIN_VIEW_CONTROLLER_H_ |
| OLD | NEW |