OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_WEBUI_CHROMEOS_LOGIN_GAIA_SCREEN_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_GAIA_SCREEN_HANDLER_H_ |
6 #define CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_GAIA_SCREEN_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_GAIA_SCREEN_HANDLER_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 | 68 |
69 // BaseScreenHandler implementation: | 69 // BaseScreenHandler implementation: |
70 virtual void DeclareLocalizedValues(LocalizedValuesBuilder* builder) OVERRIDE; | 70 virtual void DeclareLocalizedValues(LocalizedValuesBuilder* builder) OVERRIDE; |
71 virtual void Initialize() OVERRIDE; | 71 virtual void Initialize() OVERRIDE; |
72 | 72 |
73 // WebUIMessageHandler implementation: | 73 // WebUIMessageHandler implementation: |
74 virtual void RegisterMessages() OVERRIDE; | 74 virtual void RegisterMessages() OVERRIDE; |
75 | 75 |
76 // WebUI message handlers. | 76 // WebUI message handlers. |
77 void HandleFrameLoadingCompleted(int status); | 77 void HandleFrameLoadingCompleted(int status); |
| 78 void HandleCompleteAuthentication(const std::string& email, |
| 79 const std::string& password, |
| 80 const std::string& auth_code); |
| 81 void HandleCompleteLogin(const std::string& typed_email, |
| 82 const std::string& password, |
| 83 bool using_saml); |
| 84 |
| 85 void HandleUsingSAMLAPI(); |
| 86 void HandleScrapedPasswordCount(int password_count); |
| 87 void HandleScrapedPasswordVerificationFailed(); |
| 88 |
| 89 void HandleGaiaUIReady(); |
| 90 |
| 91 // Fill GAIA user name. |
| 92 void PopulateEmail(const std::string& user_id); |
| 93 |
| 94 // Mark user as having password changed: |
| 95 void PasswordChangedFor(const std::string& user_id); |
| 96 |
| 97 // Kick off cookie / local storage cleanup. |
| 98 void StartClearingCookies(const base::Closure& on_clear_callback); |
| 99 void OnCookiesCleared(const base::Closure& on_clear_callback); |
| 100 |
| 101 // Kick off DNS cache flushing. |
| 102 void StartClearingDnsCache(); |
| 103 void OnDnsCleared(); |
| 104 |
| 105 // Show sign-in screen for the given credentials. |
| 106 virtual void ShowSigninScreenForCreds(const std::string& username, |
| 107 const std::string& password); |
| 108 // Attempts login for test. |
| 109 void SubmitLoginFormForTest(); |
| 110 |
| 111 // Updates the member variable and UMA histogram indicating whether the |
| 112 // principals API was used during SAML login. |
| 113 void SetSAMLPrincipalsAPIUsed(bool api_used); |
| 114 |
| 115 void ShowGaia(); |
| 116 |
| 117 // Shows signin screen after dns cache and cookie cleanup operations finish. |
| 118 void ShowGaiaScreenIfReady(); |
| 119 |
| 120 // Decides whether an auth extension should be pre-loaded. If it should, |
| 121 // pre-loads it. |
| 122 void MaybePreloadAuthExtension(); |
| 123 |
| 124 // Tells webui to load authentication extension. |force| is used to force the |
| 125 // extension reloading, if it has already been loaded. |silent_load| is true |
| 126 // for cases when extension should be loaded in the background and it |
| 127 // shouldn't grab the focus. |offline| is true when offline version of the |
| 128 // extension should be used. |
| 129 void LoadAuthExtension(bool force, bool silent_load, bool offline); |
78 | 130 |
79 // TODO (ygorshenin@): GaiaScreenHandler should implement | 131 // TODO (ygorshenin@): GaiaScreenHandler should implement |
80 // NetworkStateInformer::Observer. | 132 // NetworkStateInformer::Observer. |
81 void UpdateState(ErrorScreenActor::ErrorReason reason); | 133 void UpdateState(ErrorScreenActor::ErrorReason reason); |
82 | 134 |
83 // TODO (ygorshenin@): remove this dependency. | 135 // TODO (ygorshenin@): remove this dependency. |
84 void SetSigninScreenHandler(SigninScreenHandler* handler); | 136 void SetSigninScreenHandler(SigninScreenHandler* handler); |
85 | 137 |
| 138 SigninScreenHandlerDelegate* Delegate(); |
| 139 |
86 // Current state of Gaia frame. | 140 // Current state of Gaia frame. |
87 FrameState frame_state_; | 141 FrameState frame_state_; |
88 | 142 |
89 // Latest Gaia frame error. | 143 // Latest Gaia frame error. |
90 net::Error frame_error_; | 144 net::Error frame_error_; |
91 | 145 |
92 // Network state informer used to keep signin screen up. | 146 // Network state informer used to keep signin screen up. |
93 scoped_refptr<NetworkStateInformer> network_state_informer_; | 147 scoped_refptr<NetworkStateInformer> network_state_informer_; |
94 | 148 |
| 149 // Email to pre-populate with. |
| 150 std::string populated_email_; |
| 151 |
| 152 // Emails of the users, whose passwords have recently been changed. |
| 153 std::set<std::string> password_changed_for_; |
| 154 |
| 155 // True if dns cache cleanup is done. |
| 156 bool dns_cleared_; |
| 157 |
| 158 // True if DNS cache task is already running. |
| 159 bool dns_clear_task_running_; |
| 160 |
| 161 // True if cookie jar cleanup is done. |
| 162 bool cookies_cleared_; |
| 163 |
| 164 // Is focus still stolen from Gaia page? |
| 165 bool focus_stolen_; |
| 166 |
| 167 // Has Gaia page silent load been started for the current sign-in attempt? |
| 168 bool gaia_silent_load_; |
| 169 |
| 170 // The active network at the moment when Gaia page was preloaded. |
| 171 std::string gaia_silent_load_network_; |
| 172 |
| 173 // If the user authenticated via SAML, this indicates whether the principals |
| 174 // API was used. |
| 175 bool using_saml_api_; |
| 176 |
| 177 // Test credentials. |
| 178 std::string test_user_; |
| 179 std::string test_pass_; |
| 180 bool test_expects_complete_login_; |
| 181 |
95 // Non-owning ptr to SigninScreenHandler instance. Should not be used | 182 // Non-owning ptr to SigninScreenHandler instance. Should not be used |
96 // in dtor. | 183 // in dtor. |
97 // TODO (ygorshenin@): GaiaScreenHandler shouldn't communicate with | 184 // TODO (ygorshenin@): GaiaScreenHandler shouldn't communicate with |
98 // signin_screen_handler directly. | 185 // signin_screen_handler directly. |
99 SigninScreenHandler* signin_screen_handler_; | 186 SigninScreenHandler* signin_screen_handler_; |
100 | 187 |
| 188 base::WeakPtrFactory<GaiaScreenHandler> weak_factory_; |
| 189 |
101 DISALLOW_COPY_AND_ASSIGN(GaiaScreenHandler); | 190 DISALLOW_COPY_AND_ASSIGN(GaiaScreenHandler); |
102 }; | 191 }; |
103 | 192 |
104 } // namespace chromeos | 193 } // namespace chromeos |
105 | 194 |
106 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_GAIA_SCREEN_HANDLER_H_ | 195 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_GAIA_SCREEN_HANDLER_H_ |
OLD | NEW |