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

Unified Diff: components/gcm_driver/fake_gcm_client.cc

Issue 617003005: Keep the GCM data intact when the user signs out of the profile (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 2 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
« no previous file with comments | « components/gcm_driver/fake_gcm_client.h ('k') | components/gcm_driver/fake_gcm_driver.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/gcm_driver/fake_gcm_client.cc
diff --git a/components/gcm_driver/fake_gcm_client.cc b/components/gcm_driver/fake_gcm_client.cc
index 6ad3816e1810e87fd40d459e2225d9288ba390ce..605122249165ac171af3e5e52a8bb201073e7235 100644
--- a/components/gcm_driver/fake_gcm_client.cc
+++ b/components/gcm_driver/fake_gcm_client.cc
@@ -8,6 +8,7 @@
#include "base/logging.h"
#include "base/message_loop/message_loop.h"
#include "base/sequenced_task_runner.h"
+#include "base/strings/string_number_conversions.h"
#include "base/sys_byteorder.h"
#include "base/time/time.h"
#include "google_apis/gcm/base/encryptor.h"
@@ -21,6 +22,7 @@ FakeGCMClient::FakeGCMClient(
const scoped_refptr<base::SequencedTaskRunner>& ui_thread,
const scoped_refptr<base::SequencedTaskRunner>& io_thread)
: delegate_(NULL),
+ sequence_id_(0),
status_(UNINITIALIZED),
start_mode_(start_mode),
ui_thread_(ui_thread),
@@ -68,6 +70,7 @@ void FakeGCMClient::Stop() {
void FakeGCMClient::CheckOut() {
DCHECK(io_thread_->RunsTasksOnCurrentThread());
status_ = CHECKED_OUT;
+ sequence_id_++;
}
void FakeGCMClient::Register(const std::string& app_id,
@@ -157,9 +160,8 @@ void FakeGCMClient::DeleteMessages(const std::string& app_id) {
app_id));
}
-// static
std::string FakeGCMClient::GetRegistrationIdFromSenderIds(
- const std::vector<std::string>& sender_ids) {
+ const std::vector<std::string>& sender_ids) const {
// GCMService normalizes the sender IDs by making them sorted.
std::vector<std::string> normalized_sender_ids = sender_ids;
std::sort(normalized_sender_ids.begin(), normalized_sender_ids.end());
@@ -175,6 +177,7 @@ std::string FakeGCMClient::GetRegistrationIdFromSenderIds(
registration_id += ",";
registration_id += normalized_sender_ids[i];
}
+ registration_id += base::IntToString(sequence_id_);
}
return registration_id;
}
« no previous file with comments | « components/gcm_driver/fake_gcm_client.h ('k') | components/gcm_driver/fake_gcm_driver.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698