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

Unified Diff: chrome/browser/sync_file_system/drive_backend_v1/api_util.cc

Issue 150003004: Replace PO2TS::GetPrimaryAccountId() with SMB::GetAuthenticatedAccountId. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 6 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/sync_file_system/drive_backend_v1/api_util.cc
diff --git a/chrome/browser/sync_file_system/drive_backend_v1/api_util.cc b/chrome/browser/sync_file_system/drive_backend_v1/api_util.cc
index ef2580b6fbddbad2a7de88edcdfdd8708e32345c..64911469dad4715cd8b619f793871e1528dbdbe4 100644
--- a/chrome/browser/sync_file_system/drive_backend_v1/api_util.cc
+++ b/chrome/browser/sync_file_system/drive_backend_v1/api_util.cc
@@ -22,6 +22,8 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/signin/profile_oauth2_token_service.h"
#include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
+#include "chrome/browser/signin/signin_manager.h"
+#include "chrome/browser/signin/signin_manager_factory.h"
#include "chrome/browser/sync_file_system/drive_backend/drive_backend_constants.h"
#include "chrome/browser/sync_file_system/drive_backend_v1/drive_file_sync_util.h"
#include "chrome/browser/sync_file_system/logger.h"
@@ -157,6 +159,7 @@ bool CreateTemporaryFile(const base::FilePath& dir_path,
APIUtil::APIUtil(Profile* profile,
const base::FilePath& temp_dir_path)
: oauth_service_(ProfileOAuth2TokenServiceFactory::GetForProfile(profile)),
+ signin_manager_(SigninManagerFactory::GetForProfile(profile)),
upload_next_key_(0),
temp_dir_path_(temp_dir_path),
has_initialized_token_(false) {
@@ -183,7 +186,7 @@ APIUtil::APIUtil(Profile* profile,
std::string() /* custom_user_agent */));
}
- drive_service_->Initialize(oauth_service_->GetPrimaryAccountId());
+ drive_service_->Initialize(signin_manager_->GetAuthenticatedAccountId());
drive_service_->AddObserver(this);
has_initialized_token_ = drive_service_->HasRefreshToken();
@@ -663,7 +666,7 @@ GURL APIUtil::DirectoryTitleToOrigin(const std::string& title) {
void APIUtil::OnReadyToSendRequests() {
DCHECK(CalledOnValidThread());
if (!has_initialized_token_) {
- drive_service_->Initialize(oauth_service_->GetPrimaryAccountId());
+ drive_service_->Initialize(signin_manager_->GetAuthenticatedAccountId());
has_initialized_token_ = true;
}
FOR_EACH_OBSERVER(APIUtilObserver, observers_, OnAuthenticated());

Powered by Google App Engine
This is Rietveld 408576698