OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/ios/browser/profile_oauth2_token_service_ios_delegat
e.h" | 5 #include "components/signin/ios/browser/profile_oauth2_token_service_ios_delegat
e.h" |
6 | 6 |
7 #import <Foundation/Foundation.h> | 7 #import <Foundation/Foundation.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <set> | 10 #include <set> |
11 #include <string> | 11 #include <string> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/bind.h" | 14 #include "base/bind.h" |
15 #include "base/macros.h" | 15 #include "base/macros.h" |
16 #include "base/message_loop/message_loop.h" | 16 #include "base/message_loop/message_loop.h" |
17 #include "base/stl_util.h" | 17 #include "base/stl_util.h" |
18 #include "base/strings/sys_string_conversions.h" | 18 #include "base/strings/sys_string_conversions.h" |
19 #include "base/values.h" | 19 #include "base/values.h" |
20 #include "components/prefs/pref_service.h" | 20 #include "components/prefs/pref_service.h" |
21 #include "components/prefs/scoped_user_pref_update.h" | 21 #include "components/prefs/scoped_user_pref_update.h" |
22 #include "components/signin/core/browser/account_info.h" | 22 #include "components/signin/core/browser/account_info.h" |
23 #include "components/signin/core/browser/account_tracker_service.h" | 23 #include "components/signin/core/browser/account_tracker_service.h" |
24 #include "components/signin/core/browser/signin_client.h" | 24 #include "components/signin/core/browser/signin_client.h" |
25 #include "components/signin/core/common/signin_pref_names.h" | 25 #include "components/signin/core/common/signin_pref_names.h" |
26 #include "components/signin/ios/browser/profile_oauth2_token_service_ios_provide
r.h" | 26 #include "components/signin/ios/browser/profile_oauth2_token_service_ios_provide
r.h" |
27 #include "google_apis/gaia/oauth2_access_token_fetcher.h" | 27 #include "google_apis/gaia/oauth2_access_token_fetcher.h" |
28 #include "net/url_request/url_request_status.h" | 28 #include "net/url_request/url_request_status.h" |
29 | 29 |
| 30 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 31 #error "This file requires ARC support." |
| 32 #endif |
| 33 |
30 namespace { | 34 namespace { |
31 | 35 |
32 // Match the way Chromium handles authentication errors in | 36 // Match the way Chromium handles authentication errors in |
33 // google_apis/gaia/oauth2_access_token_fetcher.cc: | 37 // google_apis/gaia/oauth2_access_token_fetcher.cc: |
34 GoogleServiceAuthError GetGoogleServiceAuthErrorFromNSError( | 38 GoogleServiceAuthError GetGoogleServiceAuthErrorFromNSError( |
35 ProfileOAuth2TokenServiceIOSProvider* provider, | 39 ProfileOAuth2TokenServiceIOSProvider* provider, |
36 const std::string& gaia_id, | 40 const std::string& gaia_id, |
37 NSError* error) { | 41 NSError* error) { |
38 if (!error) | 42 if (!error) |
39 return GoogleServiceAuthError::AuthErrorNone(); | 43 return GoogleServiceAuthError::AuthErrorNone(); |
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 accounts_.erase(account_id); | 389 accounts_.erase(account_id); |
386 FireRefreshTokenRevoked(account_id); | 390 FireRefreshTokenRevoked(account_id); |
387 } | 391 } |
388 } | 392 } |
389 | 393 |
390 void ProfileOAuth2TokenServiceIOSDelegate::ClearExcludedSecondaryAccounts() { | 394 void ProfileOAuth2TokenServiceIOSDelegate::ClearExcludedSecondaryAccounts() { |
391 client_->GetPrefs()->ClearPref( | 395 client_->GetPrefs()->ClearPref( |
392 prefs::kTokenServiceExcludeAllSecondaryAccounts); | 396 prefs::kTokenServiceExcludeAllSecondaryAccounts); |
393 client_->GetPrefs()->ClearPref(prefs::kTokenServiceExcludedSecondaryAccounts); | 397 client_->GetPrefs()->ClearPref(prefs::kTokenServiceExcludedSecondaryAccounts); |
394 } | 398 } |
OLD | NEW |