| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/chromeos/policy/policy_oauth2_token_fetcher.h" | 5 #include "chrome/browser/chromeos/policy/policy_oauth2_token_fetcher.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 | 50 |
| 51 void PolicyOAuth2TokenFetcher::StartFetchingRefreshToken() { | 51 void PolicyOAuth2TokenFetcher::StartFetchingRefreshToken() { |
| 52 refresh_token_fetcher_.reset(new GaiaAuthFetcher( | 52 refresh_token_fetcher_.reset(new GaiaAuthFetcher( |
| 53 this, GaiaConstants::kChromeSource, auth_context_getter_.get())); | 53 this, GaiaConstants::kChromeSource, auth_context_getter_.get())); |
| 54 refresh_token_fetcher_->StartCookieForOAuthLoginTokenExchange(std::string()); | 54 refresh_token_fetcher_->StartCookieForOAuthLoginTokenExchange(std::string()); |
| 55 } | 55 } |
| 56 | 56 |
| 57 void PolicyOAuth2TokenFetcher::StartFetchingAccessToken() { | 57 void PolicyOAuth2TokenFetcher::StartFetchingAccessToken() { |
| 58 std::vector<std::string> scopes; | 58 std::vector<std::string> scopes; |
| 59 scopes.push_back(GaiaConstants::kDeviceManagementServiceOAuth); | 59 scopes.push_back(GaiaConstants::kDeviceManagementServiceOAuth); |
| 60 scopes.push_back( |
| 61 GaiaUrls::GetInstance()->oauth_wrap_bridge_user_info_scope()); |
| 60 access_token_fetcher_.reset( | 62 access_token_fetcher_.reset( |
| 61 new OAuth2AccessTokenFetcher(this, system_context_getter_.get())); | 63 new OAuth2AccessTokenFetcher(this, system_context_getter_.get())); |
| 62 access_token_fetcher_->Start( | 64 access_token_fetcher_->Start( |
| 63 GaiaUrls::GetInstance()->oauth2_chrome_client_id(), | 65 GaiaUrls::GetInstance()->oauth2_chrome_client_id(), |
| 64 GaiaUrls::GetInstance()->oauth2_chrome_client_secret(), | 66 GaiaUrls::GetInstance()->oauth2_chrome_client_secret(), |
| 65 oauth2_refresh_token_, | 67 oauth2_refresh_token_, |
| 66 scopes); | 68 scopes); |
| 67 } | 69 } |
| 68 | 70 |
| 69 void PolicyOAuth2TokenFetcher::OnClientOAuthSuccess( | 71 void PolicyOAuth2TokenFetcher::OnClientOAuthSuccess( |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 } | 125 } |
| 124 | 126 |
| 125 void PolicyOAuth2TokenFetcher::ForwardPolicyToken( | 127 void PolicyOAuth2TokenFetcher::ForwardPolicyToken( |
| 126 const std::string& token, | 128 const std::string& token, |
| 127 const GoogleServiceAuthError& error) { | 129 const GoogleServiceAuthError& error) { |
| 128 if (!callback_.is_null()) | 130 if (!callback_.is_null()) |
| 129 callback_.Run(token, error); | 131 callback_.Run(token, error); |
| 130 } | 132 } |
| 131 | 133 |
| 132 } // namespace policy | 134 } // namespace policy |
| OLD | NEW |