| 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_impl.h" | 5 #include "chrome/browser/ui/webui/signin/inline_login_handler_impl.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 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 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 | 269 |
| 270 void InlineLoginHandlerImpl::SetExtraInitParams(base::DictionaryValue& params) { | 270 void InlineLoginHandlerImpl::SetExtraInitParams(base::DictionaryValue& params) { |
| 271 params.SetString("service", "chromiumsync"); | 271 params.SetString("service", "chromiumsync"); |
| 272 | 272 |
| 273 content::WebContents* contents = web_ui()->GetWebContents(); | 273 content::WebContents* contents = web_ui()->GetWebContents(); |
| 274 const GURL& current_url = contents->GetURL(); | 274 const GURL& current_url = contents->GetURL(); |
| 275 std::string is_constrained; | 275 std::string is_constrained; |
| 276 net::GetValueForKeyInQuery(current_url, "constrained", &is_constrained); | 276 net::GetValueForKeyInQuery(current_url, "constrained", &is_constrained); |
| 277 | 277 |
| 278 content::WebContentsObserver::Observe(contents); | 278 content::WebContentsObserver::Observe(contents); |
| 279 | 279 OneClickSigninHelper::LogHistogramValue(one_click_signin::HISTOGRAM_SHOWN); |
| 280 signin::Source source = signin::GetSourceForPromoURL(current_url); | |
| 281 OneClickSigninHelper::LogHistogramValue( | |
| 282 source, one_click_signin::HISTOGRAM_SHOWN); | |
| 283 } | 280 } |
| 284 | 281 |
| 285 void InlineLoginHandlerImpl::CompleteLogin(const base::ListValue* args) { | 282 void InlineLoginHandlerImpl::CompleteLogin(const base::ListValue* args) { |
| 286 content::WebContents* contents = web_ui()->GetWebContents(); | 283 content::WebContents* contents = web_ui()->GetWebContents(); |
| 287 const GURL& current_url = contents->GetURL(); | 284 const GURL& current_url = contents->GetURL(); |
| 288 | 285 |
| 289 const base::DictionaryValue* dict = NULL; | 286 const base::DictionaryValue* dict = NULL; |
| 290 args->GetDictionary(0, &dict); | 287 args->GetDictionary(0, &dict); |
| 291 | 288 |
| 292 bool skip_for_now = false; | 289 bool skip_for_now = false; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 | 326 |
| 330 base::string16 session_index_string16; | 327 base::string16 session_index_string16; |
| 331 dict->GetString("sessionIndex", &session_index_string16); | 328 dict->GetString("sessionIndex", &session_index_string16); |
| 332 std::string session_index = base::UTF16ToASCII(session_index_string16); | 329 std::string session_index = base::UTF16ToASCII(session_index_string16); |
| 333 DCHECK(!session_index.empty()); | 330 DCHECK(!session_index.empty()); |
| 334 | 331 |
| 335 bool choose_what_to_sync = false; | 332 bool choose_what_to_sync = false; |
| 336 dict->GetBoolean("chooseWhatToSync", &choose_what_to_sync); | 333 dict->GetBoolean("chooseWhatToSync", &choose_what_to_sync); |
| 337 | 334 |
| 338 signin::Source source = signin::GetSourceForPromoURL(current_url); | 335 signin::Source source = signin::GetSourceForPromoURL(current_url); |
| 339 OneClickSigninHelper::LogHistogramValue( | 336 OneClickSigninHelper::LogHistogramValue(one_click_signin::HISTOGRAM_ACCEPTED); |
| 340 source, one_click_signin::HISTOGRAM_ACCEPTED); | |
| 341 bool switch_to_advanced = | 337 bool switch_to_advanced = |
| 342 choose_what_to_sync && (source != signin::SOURCE_SETTINGS); | 338 choose_what_to_sync && (source != signin::SOURCE_SETTINGS); |
| 343 OneClickSigninHelper::LogHistogramValue( | 339 OneClickSigninHelper::LogHistogramValue( |
| 344 source, | |
| 345 switch_to_advanced ? one_click_signin::HISTOGRAM_WITH_ADVANCED : | 340 switch_to_advanced ? one_click_signin::HISTOGRAM_WITH_ADVANCED : |
| 346 one_click_signin::HISTOGRAM_WITH_DEFAULTS); | 341 one_click_signin::HISTOGRAM_WITH_DEFAULTS); |
| 347 | 342 |
| 348 OneClickSigninHelper::CanOfferFor can_offer_for = | 343 OneClickSigninHelper::CanOfferFor can_offer_for = |
| 349 OneClickSigninHelper::CAN_OFFER_FOR_ALL; | 344 OneClickSigninHelper::CAN_OFFER_FOR_ALL; |
| 350 switch (source) { | 345 switch (source) { |
| 351 case signin::SOURCE_AVATAR_BUBBLE_ADD_ACCOUNT: | 346 case signin::SOURCE_AVATAR_BUBBLE_ADD_ACCOUNT: |
| 352 can_offer_for = OneClickSigninHelper::CAN_OFFER_FOR_SECONDARY_ACCOUNT; | 347 can_offer_for = OneClickSigninHelper::CAN_OFFER_FOR_SECONDARY_ACCOUNT; |
| 353 break; | 348 break; |
| 354 case signin::SOURCE_REAUTH: { | 349 case signin::SOURCE_REAUTH: { |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 456 } | 451 } |
| 457 } | 452 } |
| 458 | 453 |
| 459 if (show_account_management) { | 454 if (show_account_management) { |
| 460 browser->window()->ShowAvatarBubbleFromAvatarButton( | 455 browser->window()->ShowAvatarBubbleFromAvatarButton( |
| 461 BrowserWindow::AVATAR_BUBBLE_MODE_ACCOUNT_MANAGEMENT, | 456 BrowserWindow::AVATAR_BUBBLE_MODE_ACCOUNT_MANAGEMENT, |
| 462 signin::ManageAccountsParams()); | 457 signin::ManageAccountsParams()); |
| 463 } | 458 } |
| 464 } | 459 } |
| 465 } | 460 } |
| OLD | NEW |