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

Side by Side Diff: chrome/browser/net/gaia/token_service.cc

Issue 3473006: Fix a bunch of clang warnings/errors. (Closed)
Patch Set: Created 10 years, 3 months 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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/net/gaia/token_service.h" 5 #include "chrome/browser/net/gaia/token_service.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "chrome/browser/chrome_thread.h" 9 #include "chrome/browser/chrome_thread.h"
10 #include "chrome/browser/profile.h" 10 #include "chrome/browser/profile.h"
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 const std::string& auth_token) { 103 const std::string& auth_token) {
104 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI)); 104 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI));
105 web_data_service_->SetTokenForService(service, auth_token); 105 web_data_service_->SetTokenForService(service, auth_token);
106 } 106 }
107 107
108 void TokenService::EraseTokensFromDB() { 108 void TokenService::EraseTokensFromDB() {
109 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI)); 109 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI));
110 web_data_service_->RemoveAllTokens(); 110 web_data_service_->RemoveAllTokens();
111 } 111 }
112 112
113 const bool TokenService::AreCredentialsValid() const { 113 bool TokenService::AreCredentialsValid() const {
114 return !credentials_.lsid.empty() && !credentials_.sid.empty(); 114 return !credentials_.lsid.empty() && !credentials_.sid.empty();
115 } 115 }
116 116
117 const bool TokenService::HasLsid() const { 117 bool TokenService::HasLsid() const {
118 return !credentials_.lsid.empty(); 118 return !credentials_.lsid.empty();
119 } 119 }
120 120
121 const std::string& TokenService::GetLsid() const { 121 const std::string& TokenService::GetLsid() const {
122 return credentials_.lsid; 122 return credentials_.lsid;
123 } 123 }
124 124
125 void TokenService::StartFetchingTokens() { 125 void TokenService::StartFetchingTokens() {
126 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI)); 126 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI));
127 DCHECK(AreCredentialsValid()); 127 DCHECK(AreCredentialsValid());
128 for (int i = 0; i < kNumServices; i++) { 128 for (int i = 0; i < kNumServices; i++) {
129 fetchers_[i]->StartIssueAuthToken(credentials_.sid, 129 fetchers_[i]->StartIssueAuthToken(credentials_.sid,
130 credentials_.lsid, 130 credentials_.lsid,
131 kServices[i]); 131 kServices[i]);
132 } 132 }
133 } 133 }
134 134
135 // Services dependent on a token will check if a token is available. 135 // Services dependent on a token will check if a token is available.
136 // If it isn't, they'll go to sleep until they get a token event. 136 // If it isn't, they'll go to sleep until they get a token event.
137 const bool TokenService::HasTokenForService(const char* const service) const { 137 bool TokenService::HasTokenForService(const char* const service) const {
138 return token_map_.count(service) > 0; 138 return token_map_.count(service) > 0;
139 } 139 }
140 140
141 const std::string& TokenService::GetTokenForService( 141 const std::string& TokenService::GetTokenForService(
142 const char* const service) const { 142 const char* const service) const {
143 143
144 if (token_map_.count(service) > 0) { 144 if (token_map_.count(service) > 0) {
145 // Note map[key] is not const. 145 // Note map[key] is not const.
146 return (*token_map_.find(service)).second; 146 return (*token_map_.find(service)).second;
147 } 147 }
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 } 248 }
249 249
250 void TokenService::Observe(NotificationType type, 250 void TokenService::Observe(NotificationType type,
251 const NotificationSource& source, 251 const NotificationSource& source,
252 const NotificationDetails& details) { 252 const NotificationDetails& details) {
253 DCHECK(type == NotificationType::TOKEN_UPDATED); 253 DCHECK(type == NotificationType::TOKEN_UPDATED);
254 TokenAvailableDetails* tok_details = 254 TokenAvailableDetails* tok_details =
255 Details<TokenAvailableDetails>(details).ptr(); 255 Details<TokenAvailableDetails>(details).ptr();
256 OnIssueAuthTokenSuccess(tok_details->service(), tok_details->token()); 256 OnIssueAuthTokenSuccess(tok_details->service(), tok_details->token());
257 } 257 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698