OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/signin/core/browser/signin_manager.h" | 5 #include "components/signin/core/browser/signin_manager.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
11 #include "base/prefs/pref_service.h" | 11 #include "base/prefs/pref_service.h" |
12 #include "base/strings/string_split.h" | 12 #include "base/strings/string_split.h" |
13 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
14 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
15 #include "base/time/time.h" | 15 #include "base/time/time.h" |
16 #include "components/signin/core/browser/profile_oauth2_token_service.h" | 16 #include "components/signin/core/browser/profile_oauth2_token_service.h" |
17 #include "components/signin/core/browser/signin_account_id_helper.h" | 17 #include "components/signin/core/browser/signin_account_id_helper.h" |
18 #include "components/signin/core/browser/signin_client.h" | 18 #include "components/signin/core/browser/signin_client.h" |
19 #include "components/signin/core/browser/signin_internals_util.h" | 19 #include "components/signin/core/browser/signin_internals_util.h" |
20 #include "components/signin/core/browser/signin_manager_cookie_helper.h" | 20 #include "components/signin/core/browser/signin_manager_cookie_helper.h" |
21 #include "components/signin/core/browser/signin_metrics.h" | 21 #include "components/signin/core/browser/signin_metrics.h" |
22 #include "components/signin/core/common/signin_pref_names.h" | 22 #include "components/signin/core/common/signin_pref_names.h" |
23 #include "google_apis/gaia/gaia_auth_util.h" | 23 #include "google_apis/gaia/gaia_auth_util.h" |
| 24 #include "google_apis/gaia/gaia_constants.h" |
24 #include "google_apis/gaia/gaia_urls.h" | 25 #include "google_apis/gaia/gaia_urls.h" |
25 #include "net/base/escape.h" | 26 #include "net/base/escape.h" |
26 #include "third_party/icu/source/i18n/unicode/regex.h" | 27 #include "third_party/icu/source/i18n/unicode/regex.h" |
27 | 28 |
28 using namespace signin_internals_util; | 29 using namespace signin_internals_util; |
29 | 30 |
30 namespace { | 31 namespace { |
31 | 32 |
32 const char kChromiumSyncService[] = "service=chromiumsync"; | 33 const char kChromiumSyncService[] = "service=chromiumsync"; |
33 | 34 |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 void SigninManager::DisableOneClickSignIn(PrefService* prefs) { | 344 void SigninManager::DisableOneClickSignIn(PrefService* prefs) { |
344 prefs->SetBoolean(prefs::kReverseAutologinEnabled, false); | 345 prefs->SetBoolean(prefs::kReverseAutologinEnabled, false); |
345 } | 346 } |
346 | 347 |
347 void SigninManager::CompletePendingSignin() { | 348 void SigninManager::CompletePendingSignin() { |
348 DCHECK(!possibly_invalid_username_.empty()); | 349 DCHECK(!possibly_invalid_username_.empty()); |
349 OnSignedIn(possibly_invalid_username_); | 350 OnSignedIn(possibly_invalid_username_); |
350 | 351 |
351 if (client_->ShouldMergeSigninCredentialsIntoCookieJar()) { | 352 if (client_->ShouldMergeSigninCredentialsIntoCookieJar()) { |
352 merge_session_helper_.reset(new MergeSessionHelper( | 353 merge_session_helper_.reset(new MergeSessionHelper( |
353 token_service_, client_->GetURLRequestContext(), NULL)); | 354 token_service_, GaiaConstants::kChromeSource, |
| 355 client_->GetURLRequestContext(), NULL)); |
354 } | 356 } |
355 | 357 |
356 DCHECK(!temp_refresh_token_.empty()); | 358 DCHECK(!temp_refresh_token_.empty()); |
357 DCHECK(IsAuthenticated()); | 359 DCHECK(IsAuthenticated()); |
358 token_service_->UpdateCredentials(GetAuthenticatedUsername(), | 360 token_service_->UpdateCredentials(GetAuthenticatedUsername(), |
359 temp_refresh_token_); | 361 temp_refresh_token_); |
360 temp_refresh_token_.clear(); | 362 temp_refresh_token_.clear(); |
361 | 363 |
362 if (client_->ShouldMergeSigninCredentialsIntoCookieJar()) | 364 if (client_->ShouldMergeSigninCredentialsIntoCookieJar()) |
363 merge_session_helper_->LogIn(GetAuthenticatedUsername()); | 365 merge_session_helper_->LogIn(GetAuthenticatedUsername()); |
(...skipping 25 matching lines...) Expand all Loading... |
389 | 391 |
390 password_.clear(); // Don't need it anymore. | 392 password_.clear(); // Don't need it anymore. |
391 DisableOneClickSignIn(client_->GetPrefs()); // Don't ever offer again. | 393 DisableOneClickSignIn(client_->GetPrefs()); // Don't ever offer again. |
392 } | 394 } |
393 | 395 |
394 void SigninManager::ProhibitSignout(bool prohibit_signout) { | 396 void SigninManager::ProhibitSignout(bool prohibit_signout) { |
395 prohibit_signout_ = prohibit_signout; | 397 prohibit_signout_ = prohibit_signout; |
396 } | 398 } |
397 | 399 |
398 bool SigninManager::IsSignoutProhibited() const { return prohibit_signout_; } | 400 bool SigninManager::IsSignoutProhibited() const { return prohibit_signout_; } |
OLD | NEW |