chrome/browser/signin/token_service.cc
// Load tokens from the db_token map into the in memory token map.
Load tokens from the db_token map into the in memory token map.
Load tokens from the db_token map into the in memory token map .
void TokenService::LoadTokensIntoMemory(
    const std::map<std::string, std::string>& db_tokens,
    std::map<std::string, std::string>* in_memory_tokens) {
  for (size_t i = 0; i < arraysize(kServices); ++i) {
    DCHECK(NULL == fetchers_[i].get());
  }
  for (size_t i = 0; i < arraysize(kServices); i++) {
    LoadSingleTokenIntoMemory(db_tokens, in_memory_tokens, kServices[i]);
  }
  LoadSingleTokenIntoMemory(db_tokens, in_memory_tokens,
      GaiaConstants::kGaiaOAuth2LoginRefreshToken);
  LoadSingleTokenIntoMemory(db_tokens, in_memory_tokens,
      GaiaConstants::kGaiaOAuth2LoginAccessToken);
  LoadSingleTokenIntoMemory(db_tokens, in_memory_tokens,
      GaiaConstants::kObfuscatedGaiaId);
  if (credentials_.lsid.empty() && credentials_.sid.empty()) {
    std::string lsid;
    std::string sid;
    if (db_tokens.count(GaiaConstants::kGaiaLsid) > 0)
      lsid = db_tokens.find(GaiaConstants::kGaiaLsid)->second;
    if (db_tokens.count(GaiaConstants::kGaiaSid) > 0)
      sid = db_tokens.find(GaiaConstants::kGaiaSid)->second;
    if (!lsid.empty() && !sid.empty()) {
      credentials_ = GaiaAuthConsumer::ClientLoginResult(sid,
                                                         lsid,
                                                         std::string(),
                                                         std::string());
    }
  }
}
void TokenService :: LoadTokensIntoMemory ( const std :: map < std :: string , std :: string > & db_tokens , std :: map < std :: string , std :: string > * in_memory_tokens ) { for ( size_t i = 0 ; i < arraysize ( kServices ) ; ++ i ) { DCHECK ( NULL == fetchers_ [ i ] . get ( ) ) ; } for ( size_t i = 0 ; i < arraysize ( kServices ) ; i ++ ) { LoadSingleTokenIntoMemory ( db_tokens , in_memory_tokens , kServices [ i ] ) ; } LoadSingleTokenIntoMemory ( db_tokens , in_memory_tokens , GaiaConstants :: kGaiaOAuth2LoginRefreshToken ) ; LoadSingleTokenIntoMemory ( db_tokens , in_memory_tokens , GaiaConstants :: kGaiaOAuth2LoginAccessToken ) ; LoadSingleTokenIntoMemory ( db_tokens , in_memory_tokens , GaiaConstants :: kObfuscatedGaiaId ) ; if ( credentials_ . lsid . empty ( ) && credentials_ . sid . empty ( ) ) { std :: string lsid ; std :: string sid ; if ( db_tokens . count ( GaiaConstants :: kGaiaLsid ) > 0 ) lsid = db_tokens . find ( GaiaConstants :: kGaiaLsid ) -> second ; if ( db_tokens . count ( GaiaConstants :: kGaiaSid ) > 0 ) sid = db_tokens . find ( GaiaConstants :: kGaiaSid ) -> second ; if ( ! lsid . empty ( ) && ! sid . empty ( ) ) { credentials_ = GaiaAuthConsumer :: ClientLoginResult ( sid , lsid , std :: string ( ) , std :: string ( ) ) ; } } }
Load tokens from the db_token map into the in memory token map.
Load tokens from the db_token map into the in memory token map .
// Ensure that there are no active fetchers at the time we first load // tokens from the DB into memory. // TODO(petewil): Remove next line when we refactor key-value // storage out of token_service. // Look for GAIA SID and LSID tokens.  If we have both, and the current // crendentials are empty, update the credentials.