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

Unified Diff: components/invalidation/ack_handle.cc

Issue 1191393008: Introduce a layering in the invalidation component as public and impl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Explicitly forbid content to prevent future additions Created 5 years, 6 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/invalidation/ack_handle.h ('k') | components/invalidation/ack_handler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/invalidation/ack_handle.cc
diff --git a/components/invalidation/ack_handle.cc b/components/invalidation/ack_handle.cc
deleted file mode 100644
index ee0e8b6450c98c1394a983a8e3ad2a44018b21e8..0000000000000000000000000000000000000000
--- a/components/invalidation/ack_handle.cc
+++ /dev/null
@@ -1,67 +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 "components/invalidation/ack_handle.h"
-
-#include <cstddef>
-#include "base/rand_util.h"
-#include "base/strings/string_number_conversions.h"
-#include "base/values.h"
-
-namespace syncer {
-
-namespace {
-// Hopefully enough bytes for uniqueness.
-const size_t kBytesInHandle = 16;
-} // namespace
-
-AckHandle AckHandle::CreateUnique() {
- // This isn't a valid UUID, so we don't attempt to format it like one.
- uint8 random_bytes[kBytesInHandle];
- base::RandBytes(random_bytes, sizeof(random_bytes));
- return AckHandle(base::HexEncode(random_bytes, sizeof(random_bytes)),
- base::Time::Now());
-}
-
-AckHandle AckHandle::InvalidAckHandle() {
- return AckHandle(std::string(), base::Time());
-}
-
-bool AckHandle::Equals(const AckHandle& other) const {
- return state_ == other.state_ && timestamp_ == other.timestamp_;
-}
-
-scoped_ptr<base::DictionaryValue> AckHandle::ToValue() const {
- scoped_ptr<base::DictionaryValue> value(new base::DictionaryValue());
- value->SetString("state", state_);
- value->SetString("timestamp",
- base::Int64ToString(timestamp_.ToInternalValue()));
- return value.Pass();
-}
-
-bool AckHandle::ResetFromValue(const base::DictionaryValue& value) {
- if (!value.GetString("state", &state_))
- return false;
- std::string timestamp_as_string;
- if (!value.GetString("timestamp", &timestamp_as_string))
- return false;
- int64 timestamp_value;
- if (!base::StringToInt64(timestamp_as_string, &timestamp_value))
- return false;
- timestamp_ = base::Time::FromInternalValue(timestamp_value);
- return true;
-}
-
-bool AckHandle::IsValid() const {
- return !state_.empty();
-}
-
-AckHandle::AckHandle(const std::string& state, base::Time timestamp)
- : state_(state), timestamp_(timestamp) {
-}
-
-AckHandle::~AckHandle() {
-}
-
-} // namespace syncer
« no previous file with comments | « components/invalidation/ack_handle.h ('k') | components/invalidation/ack_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698