#include "components/reading_list/core/reading_list_entry.h"
#include <memory>
#include "base/json/json_string_value_serializer.h"
#include "base/memory/ptr_util.h"
#include "base/memory/scoped_refptr.h"
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
#include "base/strings/string_util.h"
#include "base/time/time.h"
#include "components/reading_list/core/offline_url_utils.h"
#include "components/reading_list/core/proto/reading_list.pb.h"
#include "components/reading_list/core/reading_list_sync_bridge.h"
#include "components/sync/protocol/reading_list_specifics.pb.h"
#include "net/base/backoff_entry_serializer.h"
namespace {
int64_t TimeToUS(const base::Time& time) { … }
}
const net::BackoffEntry::Policy ReadingListEntry::kBackoffPolicy = …;
ReadingListEntry::ReadingListEntry(const GURL& url,
const std::string& title,
const base::Time& now)
: … { … }
ReadingListEntry::ReadingListEntry(const GURL& url,
const std::string& title,
const base::Time& now,
std::unique_ptr<net::BackoffEntry> backoff)
: … { … }
ReadingListEntry::ReadingListEntry(
const GURL& url,
const std::string& title,
base::TimeDelta estimated_read_time,
State state,
int64_t creation_time,
int64_t first_read_time,
int64_t update_time,
int64_t update_title_time,
ReadingListEntry::DistillationState distilled_state,
const base::FilePath& distilled_path,
const GURL& distilled_url,
int64_t distillation_time,
int64_t distillation_size,
int failed_download_counter,
std::unique_ptr<net::BackoffEntry> backoff)
: … { … }
ReadingListEntry::~ReadingListEntry() { … }
const GURL& ReadingListEntry::URL() const { … }
const std::string& ReadingListEntry::Title() const { … }
base::TimeDelta ReadingListEntry::EstimatedReadTime() const { … }
ReadingListEntry::DistillationState ReadingListEntry::DistilledState() const { … }
const base::FilePath& ReadingListEntry::DistilledPath() const { … }
const GURL& ReadingListEntry::DistilledURL() const { … }
int64_t ReadingListEntry::DistillationTime() const { … }
int64_t ReadingListEntry::DistillationSize() const { … }
base::TimeDelta ReadingListEntry::TimeUntilNextTry() const { … }
int ReadingListEntry::FailedDownloadCounter() const { … }
scoped_refptr<ReadingListEntry> ReadingListEntry::Clone() const { … }
bool ReadingListEntry::operator==(const ReadingListEntry& other) const { … }
void ReadingListEntry::SetTitle(const std::string& title,
const base::Time& now) { … }
void ReadingListEntry::SetRead(bool read, const base::Time& now) { … }
bool ReadingListEntry::IsRead() const { … }
bool ReadingListEntry::HasBeenSeen() const { … }
bool ReadingListEntry::IsSpecificsValid(
const sync_pb::ReadingListSpecifics& pb_entry) { … }
void ReadingListEntry::SetEstimatedReadTime(
base::TimeDelta estimated_read_time) { … }
void ReadingListEntry::SetDistilledInfo(const base::FilePath& path,
const GURL& distilled_url,
int64_t distilation_size,
const base::Time& distilation_time) { … }
void ReadingListEntry::SetDistilledState(DistillationState distilled_state) { … }
int64_t ReadingListEntry::UpdateTime() const { … }
int64_t ReadingListEntry::UpdateTitleTime() const { … }
int64_t ReadingListEntry::CreationTime() const { … }
int64_t ReadingListEntry::FirstReadTime() const { … }
void ReadingListEntry::MarkEntryUpdated(const base::Time& now) { … }
scoped_refptr<ReadingListEntry> ReadingListEntry::FromReadingListLocal(
const reading_list::ReadingListLocal& pb_entry,
const base::Time& now) { … }
scoped_refptr<ReadingListEntry> ReadingListEntry::FromReadingListValidSpecifics(
const sync_pb::ReadingListSpecifics& pb_entry,
const base::Time& now) { … }
void ReadingListEntry::MergeWithEntry(const ReadingListEntry& other) { … }
std::unique_ptr<reading_list::ReadingListLocal>
ReadingListEntry::AsReadingListLocal(const base::Time& now) const { … }
std::unique_ptr<sync_pb::ReadingListSpecifics>
ReadingListEntry::AsReadingListSpecifics() const { … }