OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/sync/one_click_signin_helper.h" | 5 #include "chrome/browser/ui/sync/one_click_signin_helper.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
316 pref_service->SetBoolean(prefs::kReverseAutologinEnabled, false); | 316 pref_service->SetBoolean(prefs::kReverseAutologinEnabled, false); |
317 } | 317 } |
318 | 318 |
319 void OneClickInfoBarDelegateImpl::AddEmailToOneClickRejectedList( | 319 void OneClickInfoBarDelegateImpl::AddEmailToOneClickRejectedList( |
320 const std::string& email) { | 320 const std::string& email) { |
321 PrefService* pref_service = | 321 PrefService* pref_service = |
322 TabContents::FromWebContents(owner()->GetWebContents())-> | 322 TabContents::FromWebContents(owner()->GetWebContents())-> |
323 profile()->GetPrefs(); | 323 profile()->GetPrefs(); |
324 ListPrefUpdate updater(pref_service, | 324 ListPrefUpdate updater(pref_service, |
325 prefs::kReverseAutologinRejectedEmailList); | 325 prefs::kReverseAutologinRejectedEmailList); |
326 updater->AppendIfNotPresent(base::Value::CreateStringValue(email)); | 326 updater->AppendIfNotPresent(new base::StringValue(email)); |
327 } | 327 } |
328 | 328 |
329 void OneClickInfoBarDelegateImpl::RecordHistogramAction(int action) { | 329 void OneClickInfoBarDelegateImpl::RecordHistogramAction(int action) { |
330 UMA_HISTOGRAM_ENUMERATION("AutoLogin.Reverse", action, | 330 UMA_HISTOGRAM_ENUMERATION("AutoLogin.Reverse", action, |
331 one_click_signin::HISTOGRAM_MAX); | 331 one_click_signin::HISTOGRAM_MAX); |
332 } | 332 } |
333 | 333 |
334 OneClickSigninHelper::OneClickSigninHelper(content::WebContents* web_contents) | 334 OneClickSigninHelper::OneClickSigninHelper(content::WebContents* web_contents) |
335 : content::WebContentsObserver(web_contents), | 335 : content::WebContentsObserver(web_contents), |
336 auto_accept_(NO_AUTO_ACCEPT) { | 336 auto_accept_(NO_AUTO_ACCEPT) { |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
398 return false; | 398 return false; |
399 } | 399 } |
400 } | 400 } |
401 } | 401 } |
402 | 402 |
403 // If email was already rejected by this profile for one-click sign-in. | 403 // If email was already rejected by this profile for one-click sign-in. |
404 if (!email.empty()) { | 404 if (!email.empty()) { |
405 const ListValue* rejected_emails = profile->GetPrefs()->GetList( | 405 const ListValue* rejected_emails = profile->GetPrefs()->GetList( |
406 prefs::kReverseAutologinRejectedEmailList); | 406 prefs::kReverseAutologinRejectedEmailList); |
407 if (!rejected_emails->empty()) { | 407 if (!rejected_emails->empty()) { |
408 const scoped_ptr<Value> email_value(Value::CreateStringValue(email)); | 408 const scoped_ptr<Value> email_value(new base::StringValue(email)); |
Evan Stade
2012/11/26 23:03:13
this should not be a scoped pointer.
| |
409 ListValue::const_iterator iter = rejected_emails->Find( | 409 base::ListValue::const_iterator iter = rejected_emails->Find( |
410 *email_value); | 410 *email_value); |
411 if (iter != rejected_emails->end()) | 411 if (iter != rejected_emails->end()) |
412 return false; | 412 return false; |
413 } | 413 } |
414 } | 414 } |
415 | 415 |
416 // If we're about to show a one-click infobar but the user has started | 416 // If we're about to show a one-click infobar but the user has started |
417 // a concurrent signin flow (perhaps via the promo), we may not have yet | 417 // a concurrent signin flow (perhaps via the promo), we may not have yet |
418 // established an authenticated username but we still shouldn't move | 418 // established an authenticated username but we still shouldn't move |
419 // forward with two simultaneous signin processes. This is a bit | 419 // forward with two simultaneous signin processes. This is a bit |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
672 session_index_ = session_index; | 672 session_index_ = session_index; |
673 email_ = email; | 673 email_ = email; |
674 } | 674 } |
675 | 675 |
676 void OneClickSigninHelper::SavePassword(const std::string& password) { | 676 void OneClickSigninHelper::SavePassword(const std::string& password) { |
677 // TODO(rogerta): in the case of a 2-factor or captcha or some other type of | 677 // TODO(rogerta): in the case of a 2-factor or captcha or some other type of |
678 // challenge, its possible for the user to never complete the signin. | 678 // challenge, its possible for the user to never complete the signin. |
679 // Should have a way to detect this and clear the password member. | 679 // Should have a way to detect this and clear the password member. |
680 password_ = password; | 680 password_ = password; |
681 } | 681 } |
OLD | NEW |