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

Side by Side Diff: chrome/browser/chromeos/contacts/google_contact_store.cc

Issue 23382008: Making OAuth2TokenService multi-login aware, updating callers, minor fixes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebasing to include the update to ProfileSyncService: r224220 Created 7 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) 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/chromeos/contacts/google_contact_store.h" 5 #include "chrome/browser/chromeos/contacts/google_contact_store.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 } 122 }
123 123
124 void GoogleContactStore::Init() { 124 void GoogleContactStore::Init() {
125 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 125 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
126 126
127 // Create a GData service if one hasn't already been assigned for testing. 127 // Create a GData service if one hasn't already been assigned for testing.
128 if (!gdata_service_.get()) { 128 if (!gdata_service_.get()) {
129 std::vector<std::string> scopes; 129 std::vector<std::string> scopes;
130 scopes.push_back(kContactsScope); 130 scopes.push_back(kContactsScope);
131 131
132 ProfileOAuth2TokenService* oauth2_service =
133 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_);
132 gdata_service_.reset(new GDataContactsService( 134 gdata_service_.reset(new GDataContactsService(
133 url_request_context_getter_, 135 url_request_context_getter_,
134 new google_apis::AuthService( 136 new google_apis::AuthService(
135 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_), 137 oauth2_service,
138 oauth2_service->GetPrimaryAccountId(),
136 url_request_context_getter_, scopes))); 139 url_request_context_getter_, scopes)));
137 } 140 }
138 141
139 base::FilePath db_path = profile_->GetPath().Append(kDatabaseDirectoryName); 142 base::FilePath db_path = profile_->GetPath().Append(kDatabaseDirectoryName);
140 VLOG(1) << "Initializing contact database \"" << db_path.value() << "\" for " 143 VLOG(1) << "Initializing contact database \"" << db_path.value() << "\" for "
141 << profile_->GetProfileName(); 144 << profile_->GetProfileName();
142 db_->Init(db_path, 145 db_->Init(db_path,
143 base::Bind(&GoogleContactStore::OnDatabaseInitialized, 146 base::Bind(&GoogleContactStore::OnDatabaseInitialized,
144 weak_ptr_factory_.GetWeakPtr())); 147 weak_ptr_factory_.GetWeakPtr()));
145 } 148 }
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 } 421 }
419 422
420 ContactStore* GoogleContactStoreFactory::CreateContactStore(Profile* profile) { 423 ContactStore* GoogleContactStoreFactory::CreateContactStore(Profile* profile) {
421 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 424 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
422 DCHECK(CanCreateContactStoreForProfile(profile)); 425 DCHECK(CanCreateContactStoreForProfile(profile));
423 return new GoogleContactStore( 426 return new GoogleContactStore(
424 g_browser_process->system_request_context(), profile); 427 g_browser_process->system_request_context(), profile);
425 } 428 }
426 429
427 } // namespace contacts 430 } // namespace contacts
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/app_mode/startup_app_launcher.cc ('k') | chrome/browser/chromeos/drive/drive_integration_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698