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