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

Unified Diff: components/gcm_driver/gcm_driver_desktop.cc

Issue 2111973002: Add support for GCM subtypes to desktop Instance ID implementation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@iid9push
Patch Set: address most of peter's concerns Created 4 years, 5 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: components/gcm_driver/gcm_driver_desktop.cc
diff --git a/components/gcm_driver/gcm_driver_desktop.cc b/components/gcm_driver/gcm_driver_desktop.cc
index d8f7fafba846ea01d4df4c71aea7a8aabd0dab54..c084c94b128d4218dab36f9b364fafe360b52dd6 100644
--- a/components/gcm_driver/gcm_driver_desktop.cc
+++ b/components/gcm_driver/gcm_driver_desktop.cc
@@ -101,10 +101,12 @@ class GCMDriverDesktop::IOWorker : public GCMClient::Delegate {
void RemoveInstanceIDData(const std::string& app_id);
void GetInstanceIDData(const std::string& app_id);
void GetToken(const std::string& app_id,
+ bool use_subtype,
const std::string& authorized_entity,
const std::string& scope,
const std::map<std::string, std::string>& options);
void DeleteToken(const std::string& app_id,
+ bool use_subtype,
const std::string& authorized_entity,
const std::string& scope);
@@ -443,6 +445,7 @@ void GCMDriverDesktop::IOWorker::GetInstanceIDData(
void GCMDriverDesktop::IOWorker::GetToken(
const std::string& app_id,
+ bool use_subtype,
const std::string& authorized_entity,
const std::string& scope,
const std::map<std::string, std::string>& options) {
@@ -451,6 +454,7 @@ void GCMDriverDesktop::IOWorker::GetToken(
std::unique_ptr<InstanceIDTokenInfo> instance_id_token_info(
new InstanceIDTokenInfo);
instance_id_token_info->app_id = app_id;
+ instance_id_token_info->use_subtype = use_subtype;
instance_id_token_info->authorized_entity = authorized_entity;
instance_id_token_info->scope = scope;
instance_id_token_info->options = options;
@@ -460,11 +464,13 @@ void GCMDriverDesktop::IOWorker::GetToken(
void GCMDriverDesktop::IOWorker::DeleteToken(
const std::string& app_id,
+ bool use_subtype,
const std::string& authorized_entity,
const std::string& scope) {
std::unique_ptr<InstanceIDTokenInfo> instance_id_token_info(
new InstanceIDTokenInfo);
instance_id_token_info->app_id = app_id;
+ instance_id_token_info->use_subtype = use_subtype;
instance_id_token_info->authorized_entity = authorized_entity;
instance_id_token_info->scope = scope;
gcm_client_->Unregister(
@@ -824,6 +830,7 @@ InstanceIDHandler* GCMDriverDesktop::GetInstanceIDHandlerInternal() {
void GCMDriverDesktop::GetToken(
const std::string& app_id,
+ bool use_subtype,
const std::string& authorized_entity,
const std::string& scope,
const std::map<std::string, std::string>& options,
@@ -851,21 +858,18 @@ void GCMDriverDesktop::GetToken(
// Delay the GetToken operation until GCMClient is ready.
if (!delayed_task_controller_->CanRunTaskWithoutDelay()) {
- delayed_task_controller_->AddTask(
- base::Bind(&GCMDriverDesktop::DoGetToken,
- weak_ptr_factory_.GetWeakPtr(),
- app_id,
- authorized_entity,
- scope,
- options));
+ delayed_task_controller_->AddTask(base::Bind(
+ &GCMDriverDesktop::DoGetToken, weak_ptr_factory_.GetWeakPtr(), app_id,
+ use_subtype, authorized_entity, scope, options));
return;
}
- DoGetToken(app_id, authorized_entity, scope, options);
+ DoGetToken(app_id, use_subtype, authorized_entity, scope, options);
}
void GCMDriverDesktop::DoGetToken(
const std::string& app_id,
+ bool use_subtype,
const std::string& authorized_entity,
const std::string& scope,
const std::map<std::string, std::string>& options) {
@@ -879,16 +883,13 @@ void GCMDriverDesktop::DoGetToken(
}
io_thread_->PostTask(
- FROM_HERE,
- base::Bind(&GCMDriverDesktop::IOWorker::GetToken,
- base::Unretained(io_worker_.get()),
- app_id,
- authorized_entity,
- scope,
- options));
+ FROM_HERE, base::Bind(&GCMDriverDesktop::IOWorker::GetToken,
+ base::Unretained(io_worker_.get()), app_id,
+ use_subtype, authorized_entity, scope, options));
}
void GCMDriverDesktop::DeleteToken(const std::string& app_id,
+ bool use_subtype,
const std::string& authorized_entity,
const std::string& scope,
const DeleteTokenCallback& callback) {
@@ -916,30 +917,25 @@ void GCMDriverDesktop::DeleteToken(const std::string& app_id,
// Delay the DeleteToken operation until GCMClient is ready.
if (!delayed_task_controller_->CanRunTaskWithoutDelay()) {
- delayed_task_controller_->AddTask(
- base::Bind(&GCMDriverDesktop::DoDeleteToken,
- weak_ptr_factory_.GetWeakPtr(),
- app_id,
- authorized_entity,
- scope));
+ delayed_task_controller_->AddTask(base::Bind(
+ &GCMDriverDesktop::DoDeleteToken, weak_ptr_factory_.GetWeakPtr(),
+ app_id, use_subtype, authorized_entity, scope));
return;
}
- DoDeleteToken(app_id, authorized_entity, scope);
+ DoDeleteToken(app_id, use_subtype, authorized_entity, scope);
}
void GCMDriverDesktop::DoDeleteToken(const std::string& app_id,
+ bool use_subtype,
const std::string& authorized_entity,
const std::string& scope) {
DCHECK(ui_thread_->RunsTasksOnCurrentThread());
- io_thread_->PostTask(
- FROM_HERE,
- base::Bind(&GCMDriverDesktop::IOWorker::DeleteToken,
- base::Unretained(io_worker_.get()),
- app_id,
- authorized_entity,
- scope));
+ io_thread_->PostTask(FROM_HERE,
+ base::Bind(&GCMDriverDesktop::IOWorker::DeleteToken,
+ base::Unretained(io_worker_.get()), app_id,
+ use_subtype, authorized_entity, scope));
}
void GCMDriverDesktop::AddInstanceIDData(

Powered by Google App Engine
This is Rietveld 408576698