Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(153)

Side by Side Diff: chrome/browser/chromeos/settings/device_oauth2_token_service.cc

Issue 106433007: Update some uses of Value in chrome/browser to use the base:: namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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/settings/device_oauth2_token_service.h" 5 #include "chrome/browser/chromeos/settings/device_oauth2_token_service.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/prefs/pref_registry_simple.h" 10 #include "base/prefs/pref_registry_simple.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 const Request* request, 49 const Request* request,
50 const std::string& access_token, 50 const std::string& access_token,
51 const base::Time& expiration_time) OVERRIDE; 51 const base::Time& expiration_time) OVERRIDE;
52 virtual void OnGetTokenFailure( 52 virtual void OnGetTokenFailure(
53 const Request* request, 53 const Request* request,
54 const GoogleServiceAuthError& error) OVERRIDE; 54 const GoogleServiceAuthError& error) OVERRIDE;
55 55
56 // gaia::GaiaOAuthClient::Delegate implementation. 56 // gaia::GaiaOAuthClient::Delegate implementation.
57 virtual void OnRefreshTokenResponse(const std::string& access_token, 57 virtual void OnRefreshTokenResponse(const std::string& access_token,
58 int expires_in_seconds) OVERRIDE; 58 int expires_in_seconds) OVERRIDE;
59 virtual void OnGetTokenInfoResponse(scoped_ptr<DictionaryValue> token_info) 59 virtual void OnGetTokenInfoResponse(
60 OVERRIDE; 60 scoped_ptr<base::DictionaryValue> token_info) OVERRIDE;
61 virtual void OnOAuthError() OVERRIDE; 61 virtual void OnOAuthError() OVERRIDE;
62 virtual void OnNetworkError(int response_code) OVERRIDE; 62 virtual void OnNetworkError(int response_code) OVERRIDE;
63 63
64 private: 64 private:
65 void RefreshTokenIsValid(bool is_valid); 65 void RefreshTokenIsValid(bool is_valid);
66 void InformConsumer(); 66 void InformConsumer();
67 67
68 DeviceOAuth2TokenService* token_service_; 68 DeviceOAuth2TokenService* token_service_;
69 Consumer* consumer_; 69 Consumer* consumer_;
70 scoped_ptr<gaia::GaiaOAuthClient> gaia_oauth_client_; 70 scoped_ptr<gaia::GaiaOAuthClient> gaia_oauth_client_;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 void DeviceOAuth2TokenService::ValidatingConsumer::OnRefreshTokenResponse( 120 void DeviceOAuth2TokenService::ValidatingConsumer::OnRefreshTokenResponse(
121 const std::string& access_token, 121 const std::string& access_token,
122 int expires_in_seconds) { 122 int expires_in_seconds) {
123 gaia_oauth_client_->GetTokenInfo( 123 gaia_oauth_client_->GetTokenInfo(
124 access_token, 124 access_token,
125 token_service_->max_refresh_token_validation_retries_, 125 token_service_->max_refresh_token_validation_retries_,
126 this); 126 this);
127 } 127 }
128 128
129 void DeviceOAuth2TokenService::ValidatingConsumer::OnGetTokenInfoResponse( 129 void DeviceOAuth2TokenService::ValidatingConsumer::OnGetTokenInfoResponse(
130 scoped_ptr<DictionaryValue> token_info) { 130 scoped_ptr<base::DictionaryValue> token_info) {
131 std::string gaia_robot_id; 131 std::string gaia_robot_id;
132 token_info->GetString("email", &gaia_robot_id); 132 token_info->GetString("email", &gaia_robot_id);
133 133
134 std::string policy_robot_id = token_service_->GetRobotAccountId(); 134 std::string policy_robot_id = token_service_->GetRobotAccountId();
135 135
136 if (policy_robot_id == gaia_robot_id) { 136 if (policy_robot_id == gaia_robot_id) {
137 RefreshTokenIsValid(true); 137 RefreshTokenIsValid(true);
138 } else { 138 } else {
139 if (gaia_robot_id.empty()) { 139 if (gaia_robot_id.empty()) {
140 LOG(WARNING) << "Device service account owner in policy is empty."; 140 LOG(WARNING) << "Device service account owner in policy is empty.";
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 return OAuth2TokenService::CreateRequest(account_id, consumer); 284 return OAuth2TokenService::CreateRequest(account_id, consumer);
285 285
286 // Substitute our own consumer to wait for refresh token validation. 286 // Substitute our own consumer to wait for refresh token validation.
287 scoped_ptr<ValidatingConsumer> validating_consumer( 287 scoped_ptr<ValidatingConsumer> validating_consumer(
288 new ValidatingConsumer(this, account_id, consumer)); 288 new ValidatingConsumer(this, account_id, consumer));
289 validating_consumer->StartValidation(); 289 validating_consumer->StartValidation();
290 return validating_consumer.PassAs<RequestImpl>(); 290 return validating_consumer.PassAs<RequestImpl>();
291 } 291 }
292 292
293 } // namespace chromeos 293 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698