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

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

Issue 3433005: Linux: More gcc 4.5 NULL versus 0 fixes. (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
« no previous file with comments | « no previous file | net/spdy/spdy_session.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/string_util.h" 7 #include "base/string_util.h"
8 #include "chrome/browser/chrome_thread.h" 8 #include "chrome/browser/chrome_thread.h"
9 #include "chrome/browser/profile.h" 9 #include "chrome/browser/profile.h"
10 #include "chrome/common/net/gaia/gaia_authenticator2.h" 10 #include "chrome/common/net/gaia/gaia_authenticator2.h"
11 #include "chrome/common/net/gaia/gaia_constants.h" 11 #include "chrome/common/net/gaia/gaia_constants.h"
12 #include "chrome/common/net/url_request_context_getter.h" 12 #include "chrome/common/net/url_request_context_getter.h"
13 #include "chrome/common/notification_service.h" 13 #include "chrome/common/notification_service.h"
14 14
15 // Unfortunately kNumServices must be defined in the .h. 15 // Unfortunately kNumServices must be defined in the .h.
16 // TODO(chron): Sync doesn't use the TalkToken anymore so we can stop 16 // TODO(chron): Sync doesn't use the TalkToken anymore so we can stop
17 // requesting it. 17 // requesting it.
18 const char* TokenService::kServices[] = {GaiaConstants::kSyncService, 18 const char* TokenService::kServices[] = {GaiaConstants::kSyncService,
19 GaiaConstants::kTalkService}; 19 GaiaConstants::kTalkService};
20 TokenService::TokenService() 20 TokenService::TokenService()
21 : token_loading_query_(NULL) { 21 : token_loading_query_(0) {
22 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI)); 22 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI));
23 } 23 }
24 24
25 TokenService::~TokenService() { 25 TokenService::~TokenService() {
26 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI)); 26 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI));
27 ResetCredentialsInMemory(); 27 ResetCredentialsInMemory();
28 } 28 }
29 29
30 void TokenService::Initialize(const char* const source, 30 void TokenService::Initialize(const char* const source,
31 Profile* profile) { 31 Profile* profile) {
(...skipping 17 matching lines...) Expand all
49 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI)); 49 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI));
50 50
51 // Terminate any running fetchers. Callbacks will not return. 51 // Terminate any running fetchers. Callbacks will not return.
52 for (int i = 0; i < kNumServices; i++) { 52 for (int i = 0; i < kNumServices; i++) {
53 fetchers_[i].reset(); 53 fetchers_[i].reset();
54 } 54 }
55 55
56 // Cancel pending loads. Callbacks will not return. 56 // Cancel pending loads. Callbacks will not return.
57 if (token_loading_query_) { 57 if (token_loading_query_) {
58 web_data_service_->CancelRequest(token_loading_query_); 58 web_data_service_->CancelRequest(token_loading_query_);
59 token_loading_query_ = NULL; 59 token_loading_query_ = 0;
60 } 60 }
61 61
62 token_map_.clear(); 62 token_map_.clear();
63 credentials_ = GaiaAuthConsumer::ClientLoginResult(); 63 credentials_ = GaiaAuthConsumer::ClientLoginResult();
64 } 64 }
65 65
66 void TokenService::UpdateCredentials( 66 void TokenService::UpdateCredentials(
67 const GaiaAuthConsumer::ClientLoginResult& credentials) { 67 const GaiaAuthConsumer::ClientLoginResult& credentials) {
68 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI)); 68 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI));
69 credentials_ = credentials; 69 credentials_ = credentials;
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 const GoogleServiceAuthError& error) { 174 const GoogleServiceAuthError& error) {
175 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI)); 175 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI));
176 LOG(WARNING) << "Auth token issuing failed for service:" << service; 176 LOG(WARNING) << "Auth token issuing failed for service:" << service;
177 FireTokenRequestFailedNotification(service, error); 177 FireTokenRequestFailedNotification(service, error);
178 } 178 }
179 179
180 void TokenService::OnWebDataServiceRequestDone(WebDataService::Handle h, 180 void TokenService::OnWebDataServiceRequestDone(WebDataService::Handle h,
181 const WDTypedResult* result) { 181 const WDTypedResult* result) {
182 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI)); 182 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI));
183 DCHECK(token_loading_query_); 183 DCHECK(token_loading_query_);
184 token_loading_query_ = NULL; 184 token_loading_query_ = 0;
185 185
186 // If the fetch failed, there will be no result. In that case, we just don't 186 // If the fetch failed, there will be no result. In that case, we just don't
187 // load any tokens at all from the DB. 187 // load any tokens at all from the DB.
188 if (result) { 188 if (result) {
189 DCHECK(result->GetType() == TOKEN_RESULT); 189 DCHECK(result->GetType() == TOKEN_RESULT);
190 const WDResult<std::map<std::string, std::string> > * token_result = 190 const WDResult<std::map<std::string, std::string> > * token_result =
191 static_cast<const WDResult<std::map<std::string, std::string> > * > ( 191 static_cast<const WDResult<std::map<std::string, std::string> > * > (
192 result); 192 result);
193 LoadTokensIntoMemory(token_result->GetValue(), &token_map_); 193 LoadTokensIntoMemory(token_result->GetValue(), &token_map_);
194 } 194 }
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 } 228 }
229 229
230 void TokenService::Observe(NotificationType type, 230 void TokenService::Observe(NotificationType type,
231 const NotificationSource& source, 231 const NotificationSource& source,
232 const NotificationDetails& details) { 232 const NotificationDetails& details) {
233 DCHECK(type == NotificationType::TOKEN_UPDATED); 233 DCHECK(type == NotificationType::TOKEN_UPDATED);
234 TokenAvailableDetails* tok_details = 234 TokenAvailableDetails* tok_details =
235 Details<TokenAvailableDetails>(details).ptr(); 235 Details<TokenAvailableDetails>(details).ptr();
236 OnIssueAuthTokenSuccess(tok_details->service(), tok_details->token()); 236 OnIssueAuthTokenSuccess(tok_details->service(), tok_details->token());
237 } 237 }
OLDNEW
« no previous file with comments | « no previous file | net/spdy/spdy_session.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698