Index: chrome/browser/services/gcm/gcm_profile_service.cc |
diff --git a/chrome/browser/services/gcm/gcm_profile_service.cc b/chrome/browser/services/gcm/gcm_profile_service.cc |
index b58f7e64029eb3a789dc86920aba86ba043de21c..a35d4d49de220e492327a785d35f66e93e723691 100644 |
--- a/chrome/browser/services/gcm/gcm_profile_service.cc |
+++ b/chrome/browser/services/gcm/gcm_profile_service.cc |
@@ -4,6 +4,9 @@ |
#include "chrome/browser/services/gcm/gcm_profile_service.h" |
+#include <string> |
+#include <vector> |
+ |
#include "base/base64.h" |
#include "base/files/file_path.h" |
#include "base/logging.h" |
@@ -19,6 +22,8 @@ |
#include "chrome/browser/extensions/state_store.h" |
#include "chrome/browser/services/gcm/gcm_client_factory.h" |
#include "chrome/browser/services/gcm/gcm_event_router.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/common/chrome_constants.h" |
@@ -257,6 +262,7 @@ class GCMProfileService::IOWorker |
void Initialize( |
GCMClientFactory* gcm_client_factory, |
const base::FilePath& store_path, |
+ const std::vector<std::string>& account_ids, |
const scoped_refptr<net::URLRequestContextGetter>& |
url_request_context_getter); |
void Reset(); |
@@ -290,6 +296,7 @@ GCMProfileService::IOWorker::~IOWorker() { |
void GCMProfileService::IOWorker::Initialize( |
GCMClientFactory* gcm_client_factory, |
const base::FilePath& store_path, |
+ const std::vector<std::string>& account_ids, |
const scoped_refptr<net::URLRequestContextGetter>& |
url_request_context_getter) { |
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); |
@@ -310,6 +317,7 @@ void GCMProfileService::IOWorker::Initialize( |
gcm_client_->Initialize(chrome_build_proto, |
store_path, |
+ account_ids, |
blocking_task_runner, |
url_request_context_getter, |
this); |
@@ -715,6 +723,10 @@ void GCMProfileService::CheckIn(const std::string& username) { |
// Load all register apps. |
ReadRegisteredAppIDs(); |
+ // Get the list of avialable accounts. |
jianli
2014/02/19 01:18:12
nit: typo for available
fgorski
2014/02/19 19:00:25
Done.
|
+ std::vector<std::string> account_ids = |
+ ProfileOAuth2TokenServiceFactory::GetForProfile(profile_)->GetAccounts(); |
+ |
// Let the IO thread create and initialize GCMClient. |
scoped_refptr<net::URLRequestContextGetter> url_request_context_getter = |
profile_->GetRequestContext(); |
@@ -725,6 +737,7 @@ void GCMProfileService::CheckIn(const std::string& username) { |
io_worker_, |
gcm_client_factory_.get(), |
profile_->GetPath().Append(chrome::kGCMStoreDirname), |
+ account_ids, |
url_request_context_getter)); |
} |