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 #include "chrome/browser/ui/webui/signin/inline_login_handler.h" | 5 #include "chrome/browser/ui/webui/signin/inline_login_handler.h" |
6 | 6 |
7 #include <limits.h> | 7 #include <limits.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
188 | 188 |
189 const std::string& app_locale = g_browser_process->GetApplicationLocale(); | 189 const std::string& app_locale = g_browser_process->GetApplicationLocale(); |
190 params.SetString("hl", app_locale); | 190 params.SetString("hl", app_locale); |
191 GaiaUrls* gaiaUrls = GaiaUrls::GetInstance(); | 191 GaiaUrls* gaiaUrls = GaiaUrls::GetInstance(); |
192 params.SetString("gaiaUrl", gaiaUrls->gaia_url().spec()); | 192 params.SetString("gaiaUrl", gaiaUrls->gaia_url().spec()); |
193 params.SetInteger("authMode", InlineLoginHandler::kDesktopAuthMode); | 193 params.SetInteger("authMode", InlineLoginHandler::kDesktopAuthMode); |
194 | 194 |
195 const GURL& current_url = web_ui()->GetWebContents()->GetURL(); | 195 const GURL& current_url = web_ui()->GetWebContents()->GetURL(); |
196 signin_metrics::AccessPoint access_point = | 196 signin_metrics::AccessPoint access_point = |
197 signin::GetAccessPointForPromoURL(current_url); | 197 signin::GetAccessPointForPromoURL(current_url); |
198 signin_metrics::LogSigninAccessPointStarted(access_point); | 198 signin_metrics::Reason reason = |
199 signin::GetSigninReasonForPromoURL(current_url); | |
200 | |
201 if (reason != signin_metrics::Reason::REASON_REAUTHENTICATION || | |
202 reason != signin_metrics::Reason::REASON_UNLOCK || | |
203 reason != signin_metrics::Reason::REASON_ADD_SECONDARY_ACCOUNT) { | |
brucedawson
2016/10/11 20:22:01
Tautology error detected. |reason| will always be
| |
204 signin_metrics::LogSigninAccessPointStarted(access_point); | |
205 } | |
199 RecordSigninUserActionForAccessPoint(access_point); | 206 RecordSigninUserActionForAccessPoint(access_point); |
200 content::RecordAction(base::UserMetricsAction("Signin_SigninPage_Loading")); | 207 content::RecordAction(base::UserMetricsAction("Signin_SigninPage_Loading")); |
201 | 208 |
202 params.SetString("continueUrl", signin::GetLandingURL(access_point).spec()); | 209 params.SetString("continueUrl", signin::GetLandingURL(access_point).spec()); |
203 | 210 |
204 Profile* profile = Profile::FromWebUI(web_ui()); | 211 Profile* profile = Profile::FromWebUI(web_ui()); |
205 signin_metrics::Reason reason = | |
206 signin::GetSigninReasonForPromoURL(current_url); | |
207 std::string default_email; | 212 std::string default_email; |
208 if (reason == signin_metrics::Reason::REASON_SIGNIN_PRIMARY_ACCOUNT) { | 213 if (reason == signin_metrics::Reason::REASON_SIGNIN_PRIMARY_ACCOUNT) { |
209 default_email = | 214 default_email = |
210 profile->GetPrefs()->GetString(prefs::kGoogleServicesLastUsername); | 215 profile->GetPrefs()->GetString(prefs::kGoogleServicesLastUsername); |
211 } else { | 216 } else { |
212 if (!net::GetValueForKeyInQuery(current_url, "email", &default_email)) | 217 if (!net::GetValueForKeyInQuery(current_url, "email", &default_email)) |
213 default_email.clear(); | 218 default_email.clear(); |
214 } | 219 } |
215 if (!default_email.empty()) | 220 if (!default_email.empty()) |
216 params.SetString("email", default_email); | 221 params.SetString("email", default_email); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
274 | 279 |
275 void InlineLoginHandler::HandleDialogClose(const base::ListValue* args) { | 280 void InlineLoginHandler::HandleDialogClose(const base::ListValue* args) { |
276 Browser* browser = signin::GetDesktopBrowser(web_ui()); | 281 Browser* browser = signin::GetDesktopBrowser(web_ui()); |
277 // If the dialog was opened in the User Manager browser will be null here. | 282 // If the dialog was opened in the User Manager browser will be null here. |
278 if (browser) | 283 if (browser) |
279 browser->CloseModalSigninWindow(); | 284 browser->CloseModalSigninWindow(); |
280 | 285 |
281 // Does nothing if user manager is not showing. | 286 // Does nothing if user manager is not showing. |
282 UserManager::HideReauthDialog(); | 287 UserManager::HideReauthDialog(); |
283 } | 288 } |
OLD | NEW |