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

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

Issue 11348220: sync: centralize sync startup decisions in TryStart. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: zea's review Created 8 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 (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/prefs/pref_service.h"
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 content::NotificationService::current()->Notify( 184 content::NotificationService::current()->Notify(
185 chrome::NOTIFICATION_TOKENS_CLEARED, 185 chrome::NOTIFICATION_TOKENS_CLEARED,
186 content::Source<TokenService>(this), 186 content::Source<TokenService>(this),
187 content::NotificationService::NoDetails()); 187 content::NotificationService::NoDetails());
188 } 188 }
189 189
190 bool TokenService::TokensLoadedFromDB() const { 190 bool TokenService::TokensLoadedFromDB() const {
191 return tokens_loaded_; 191 return tokens_loaded_;
192 } 192 }
193 193
194 void TokenService::set_tokens_loaded(bool loaded) {
195 tokens_loaded_ = loaded;
196 }
kochi 2012/11/30 07:42:02 Why not inline (define in header)? (maybe this is
tim (not reviewing) 2012/11/30 18:51:13 No solid reason. I guess just overzealous applicat
197
194 // static 198 // static
195 int TokenService::GetServiceIndex(const std::string& service) { 199 int TokenService::GetServiceIndex(const std::string& service) {
196 for (size_t i = 0; i < arraysize(kServices); ++i) { 200 for (size_t i = 0; i < arraysize(kServices); ++i) {
197 if (kServices[i] == service) 201 if (kServices[i] == service)
198 return i; 202 return i;
199 } 203 }
200 return -1; 204 return -1;
201 } 205 }
202 206
203 bool TokenService::AreCredentialsValid() const { 207 bool TokenService::AreCredentialsValid() const {
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 if (!in_memory_tokens->count(service) && db_tokens.count(service)) { 431 if (!in_memory_tokens->count(service) && db_tokens.count(service)) {
428 std::string db_token = db_tokens.find(service)->second; 432 std::string db_token = db_tokens.find(service)->second;
429 if (!db_token.empty()) { 433 if (!db_token.empty()) {
430 VLOG(1) << "Loading " << service << " token from DB: " << db_token; 434 VLOG(1) << "Loading " << service << " token from DB: " << db_token;
431 (*in_memory_tokens)[service] = db_token; 435 (*in_memory_tokens)[service] = db_token;
432 FireTokenAvailableNotification(service, db_token); 436 FireTokenAvailableNotification(service, db_token);
433 // Failures are only for network errors. 437 // Failures are only for network errors.
434 } 438 }
435 } 439 }
436 } 440 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698