| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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(GaiaConstants::kOAuthWrapBridgeUserInfoScope); | 60 scopes.push_back(GaiaConstants::kOAuthWrapBridgeUserInfoScope); |
| 61 scopes.push_back(GaiaConstants::kGoogleUserInfoEmail); | |
| 62 scopes.push_back(GaiaConstants::kGoogleUserInfoProfile); | |
| 63 access_token_fetcher_.reset( | 61 access_token_fetcher_.reset( |
| 64 new OAuth2AccessTokenFetcherImpl(this, | 62 new OAuth2AccessTokenFetcherImpl(this, |
| 65 system_context_getter_.get(), | 63 system_context_getter_.get(), |
| 66 oauth2_refresh_token_)); | 64 oauth2_refresh_token_)); |
| 67 access_token_fetcher_->Start( | 65 access_token_fetcher_->Start( |
| 68 GaiaUrls::GetInstance()->oauth2_chrome_client_id(), | 66 GaiaUrls::GetInstance()->oauth2_chrome_client_id(), |
| 69 GaiaUrls::GetInstance()->oauth2_chrome_client_secret(), | 67 GaiaUrls::GetInstance()->oauth2_chrome_client_secret(), |
| 70 scopes); | 68 scopes); |
| 71 } | 69 } |
| 72 | 70 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 } | 125 } |
| 128 | 126 |
| 129 void PolicyOAuth2TokenFetcher::ForwardPolicyToken( | 127 void PolicyOAuth2TokenFetcher::ForwardPolicyToken( |
| 130 const std::string& token, | 128 const std::string& token, |
| 131 const GoogleServiceAuthError& error) { | 129 const GoogleServiceAuthError& error) { |
| 132 if (!callback_.is_null()) | 130 if (!callback_.is_null()) |
| 133 callback_.Run(token, error); | 131 callback_.Run(token, error); |
| 134 } | 132 } |
| 135 | 133 |
| 136 } // namespace policy | 134 } // namespace policy |
| OLD | NEW |