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