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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 void InlineLoginHandler::ContinueHandleInitializeMessage() { | 62 void InlineLoginHandler::ContinueHandleInitializeMessage() { |
63 base::DictionaryValue params; | 63 base::DictionaryValue params; |
64 | 64 |
65 const std::string& app_locale = g_browser_process->GetApplicationLocale(); | 65 const std::string& app_locale = g_browser_process->GetApplicationLocale(); |
66 params.SetString("hl", app_locale); | 66 params.SetString("hl", app_locale); |
67 GaiaUrls* gaiaUrls = GaiaUrls::GetInstance(); | 67 GaiaUrls* gaiaUrls = GaiaUrls::GetInstance(); |
68 params.SetString("gaiaUrl", gaiaUrls->gaia_url().spec()); | 68 params.SetString("gaiaUrl", gaiaUrls->gaia_url().spec()); |
69 params.SetInteger("authMode", InlineLoginHandler::kDesktopAuthMode); | 69 params.SetInteger("authMode", InlineLoginHandler::kDesktopAuthMode); |
70 | 70 |
71 const GURL& current_url = web_ui()->GetWebContents()->GetURL(); | 71 const GURL& current_url = web_ui()->GetWebContents()->GetURL(); |
72 signin_metrics::Source source = signin::GetSourceForPromoURL(current_url); | 72 signin_metrics::AccessPoint access_point = |
| 73 signin::GetAccessPointForPromoURL(current_url); |
| 74 signin_metrics::LogSigninAccessPointStarted(access_point); |
73 | 75 |
74 params.SetString( | 76 params.SetString("continueUrl", signin::GetLandingURL(access_point).spec()); |
75 "continueUrl", | |
76 signin::GetLandingURL(signin::kSignInPromoQueryKeySource, | |
77 static_cast<int>(source)).spec()); | |
78 | 77 |
79 Profile* profile = Profile::FromWebUI(web_ui()); | 78 Profile* profile = Profile::FromWebUI(web_ui()); |
| 79 signin_metrics::Reason reason = |
| 80 signin::GetSigninReasonForPromoURL(current_url); |
80 std::string default_email; | 81 std::string default_email; |
81 if (source != signin_metrics::SOURCE_AVATAR_BUBBLE_ADD_ACCOUNT && | 82 if (reason == signin_metrics::Reason::REASON_SIGNIN_PRIMARY_ACCOUNT) { |
82 source != signin_metrics::SOURCE_REAUTH) { | |
83 default_email = | 83 default_email = |
84 profile->GetPrefs()->GetString(prefs::kGoogleServicesLastUsername); | 84 profile->GetPrefs()->GetString(prefs::kGoogleServicesLastUsername); |
85 } else { | 85 } else { |
86 if (!net::GetValueForKeyInQuery(current_url, "email", &default_email)) | 86 if (!net::GetValueForKeyInQuery(current_url, "email", &default_email)) |
87 default_email.clear(); | 87 default_email.clear(); |
88 } | 88 } |
89 if (!default_email.empty()) | 89 if (!default_email.empty()) |
90 params.SetString("email", default_email); | 90 params.SetString("email", default_email); |
91 | 91 |
92 std::string frame_url_id_str; | 92 std::string frame_url_id_str; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 | 144 |
145 chrome::NavigateParams params( | 145 chrome::NavigateParams params( |
146 profile, | 146 profile, |
147 net::AppendOrReplaceQueryParameter( | 147 net::AppendOrReplaceQueryParameter( |
148 main_frame_url, signin::kSignInPromoQueryKeyConstrained, "0"), | 148 main_frame_url, signin::kSignInPromoQueryKeyConstrained, "0"), |
149 ui::PAGE_TRANSITION_AUTO_TOPLEVEL); | 149 ui::PAGE_TRANSITION_AUTO_TOPLEVEL); |
150 chrome::Navigate(¶ms); | 150 chrome::Navigate(¶ms); |
151 | 151 |
152 web_ui()->CallJavascriptFunction("inline.login.closeDialog"); | 152 web_ui()->CallJavascriptFunction("inline.login.closeDialog"); |
153 } | 153 } |
OLD | NEW |