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

Side by Side Diff: chrome/browser/signin/token_service.cc

Issue 10213013: Now CHECKs to make sure we log out before clearing the token db (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/signin/token_service.h" 5 #include "chrome/browser/signin/token_service.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "chrome/browser/prefs/pref_service.h"
10 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
11 #include "chrome/common/chrome_notification_types.h" 12 #include "chrome/common/chrome_notification_types.h"
12 #include "chrome/common/chrome_switches.h" 13 #include "chrome/common/chrome_switches.h"
13 #include "chrome/common/net/gaia/gaia_auth_fetcher.h" 14 #include "chrome/common/net/gaia/gaia_auth_fetcher.h"
14 #include "chrome/common/net/gaia/gaia_constants.h" 15 #include "chrome/common/net/gaia/gaia_constants.h"
16 #include "chrome/common/pref_names.h"
15 #include "content/public/browser/browser_thread.h" 17 #include "content/public/browser/browser_thread.h"
16 #include "content/public/browser/notification_service.h" 18 #include "content/public/browser/notification_service.h"
17 #include "content/public/browser/notification_source.h" 19 #include "content/public/browser/notification_source.h"
18 #include "net/url_request/url_request_context_getter.h" 20 #include "net/url_request/url_request_context_getter.h"
19 21
20 using content::BrowserThread; 22 using content::BrowserThread;
21 23
22 namespace { 24 namespace {
23 25
24 // List of services that are capable of ClientLogin-based authentication. 26 // List of services that are capable of ClientLogin-based authentication.
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 128
127 void TokenService::SaveAuthTokenToDB(const std::string& service, 129 void TokenService::SaveAuthTokenToDB(const std::string& service,
128 const std::string& auth_token) { 130 const std::string& auth_token) {
129 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 131 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
130 if (web_data_service_.get()) 132 if (web_data_service_.get())
131 web_data_service_->SetTokenForService(service, auth_token); 133 web_data_service_->SetTokenForService(service, auth_token);
132 } 134 }
133 135
134 void TokenService::EraseTokensFromDB() { 136 void TokenService::EraseTokensFromDB() {
135 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 137 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
138 // Try to track down http://crbug.com/121755 - we should never clear the
139 // token DB while we're still logged in.
140 if (profile_) {
141 std::string user = profile_->GetPrefs()->GetString(
142 prefs::kGoogleServicesUsername);
tim (not reviewing) 2012/04/25 18:37:59 Is there anything else in TokenService that expect
143 CHECK(user.empty());
144 }
136 if (web_data_service_.get()) 145 if (web_data_service_.get())
137 web_data_service_->RemoveAllTokens(); 146 web_data_service_->RemoveAllTokens();
138 } 147 }
139 148
140 bool TokenService::TokensLoadedFromDB() const { 149 bool TokenService::TokensLoadedFromDB() const {
141 return tokens_loaded_; 150 return tokens_loaded_;
142 } 151 }
143 152
144 // static 153 // static
145 int TokenService::GetServiceIndex(const std::string& service) { 154 int TokenService::GetServiceIndex(const std::string& service) {
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 } 370 }
362 371
363 void TokenService::Observe(int type, 372 void TokenService::Observe(int type,
364 const content::NotificationSource& source, 373 const content::NotificationSource& source,
365 const content::NotificationDetails& details) { 374 const content::NotificationDetails& details) {
366 DCHECK_EQ(type, chrome::NOTIFICATION_TOKEN_UPDATED); 375 DCHECK_EQ(type, chrome::NOTIFICATION_TOKEN_UPDATED);
367 TokenAvailableDetails* tok_details = 376 TokenAvailableDetails* tok_details =
368 content::Details<TokenAvailableDetails>(details).ptr(); 377 content::Details<TokenAvailableDetails>(details).ptr();
369 OnIssueAuthTokenSuccess(tok_details->service(), tok_details->token()); 378 OnIssueAuthTokenSuccess(tok_details->service(), tok_details->token());
370 } 379 }
OLDNEW
« no previous file with comments | « chrome/browser/signin/signin_manager.cc ('k') | chrome/browser/sync/glue/typed_url_model_associator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698