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

Unified Diff: google_apis/gcm/engine/registration_info.cc

Issue 1137463003: Support getting and deleting token for Instance ID. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add new files Created 5 years, 7 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: google_apis/gcm/engine/registration_info.cc
diff --git a/google_apis/gcm/engine/registration_info.cc b/google_apis/gcm/engine/registration_info.cc
deleted file mode 100644
index 6a41c76e00e2fdeb42f62bcd63b574d848fa942e..0000000000000000000000000000000000000000
--- a/google_apis/gcm/engine/registration_info.cc
+++ /dev/null
@@ -1,62 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "google_apis/gcm/engine/registration_info.h"
-
-#include "base/strings/string_util.h"
-
-namespace gcm {
-
-RegistrationInfo::RegistrationInfo() {
-}
-
-RegistrationInfo::~RegistrationInfo() {
-}
-
-std::string RegistrationInfo::SerializeAsString() const {
- if (sender_ids.empty() || registration_id.empty())
- return std::string();
-
- // Serialize as:
- // sender1,sender2,...=reg_id
- std::string value;
- for (std::vector<std::string>::const_iterator iter = sender_ids.begin();
- iter != sender_ids.end(); ++iter) {
- DCHECK(!iter->empty() &&
- iter->find(',') == std::string::npos &&
- iter->find('=') == std::string::npos);
- if (!value.empty())
- value += ",";
- value += *iter;
- }
-
- DCHECK(registration_id.find('=') == std::string::npos);
- value += '=';
- value += registration_id;
- return value;
-}
-
-bool RegistrationInfo::ParseFromString(const std::string& value) {
- if (value.empty())
- return true;
-
- size_t pos = value.find('=');
- if (pos == std::string::npos)
- return false;
-
- std::string senders = value.substr(0, pos);
- registration_id = value.substr(pos + 1);
-
- Tokenize(senders, ",", &sender_ids);
-
- if (sender_ids.empty() || registration_id.empty()) {
- sender_ids.clear();
- registration_id.clear();
- return false;
- }
-
- return true;
-}
-
-} // namespace gcm

Powered by Google App Engine
This is Rietveld 408576698