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

Side by Side Diff: components/reading_list/reading_list_entry.cc

Issue 2514333003: Componentize Reading List (Closed)
Patch Set: rebase Created 4 years 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ios/chrome/browser/reading_list/reading_list_entry.h" 5 #include "components/reading_list/reading_list_entry.h"
6 6
7 #include "base/json/json_string_value_serializer.h" 7 #include "base/json/json_string_value_serializer.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "components/reading_list/offline_url_utils.h"
10 #include "components/reading_list/proto/reading_list.pb.h"
9 #include "components/sync/protocol/reading_list_specifics.pb.h" 11 #include "components/sync/protocol/reading_list_specifics.pb.h"
10 #include "ios/chrome/browser/reading_list/offline_url_utils.h"
11 #include "ios/chrome/browser/reading_list/proto/reading_list.pb.h"
12 #include "net/base/backoff_entry_serializer.h" 12 #include "net/base/backoff_entry_serializer.h"
13 13
14 // The backoff time is the following: 10min, 10min, 1h, 2h, 2h..., starting 14 // The backoff time is the following: 10min, 10min, 1h, 2h, 2h..., starting
15 // after the first failure. 15 // after the first failure.
16 const net::BackoffEntry::Policy ReadingListEntry::kBackoffPolicy = { 16 const net::BackoffEntry::Policy ReadingListEntry::kBackoffPolicy = {
17 // Number of initial errors (in sequence) to ignore before applying 17 // Number of initial errors (in sequence) to ignore before applying
18 // exponential back-off rules. 18 // exponential back-off rules.
19 2, 19 2,
20 20
21 // Initial delay for exponential back-off in ms. 21 // Initial delay for exponential back-off in ms.
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 } 105 }
106 106
107 ReadingListEntry::DistillationState ReadingListEntry::DistilledState() const { 107 ReadingListEntry::DistillationState ReadingListEntry::DistilledState() const {
108 return distilled_state_; 108 return distilled_state_;
109 } 109 }
110 110
111 const base::FilePath& ReadingListEntry::DistilledPath() const { 111 const base::FilePath& ReadingListEntry::DistilledPath() const {
112 return distilled_path_; 112 return distilled_path_;
113 } 113 }
114 114
115 const GURL ReadingListEntry::DistilledURL() const {
116 return reading_list::DistilledURLForPath(distilled_path_);
117 }
118
119 base::TimeDelta ReadingListEntry::TimeUntilNextTry() const { 115 base::TimeDelta ReadingListEntry::TimeUntilNextTry() const {
120 return backoff_->GetTimeUntilRelease(); 116 return backoff_->GetTimeUntilRelease();
121 } 117 }
122 118
123 int ReadingListEntry::FailedDownloadCounter() const { 119 int ReadingListEntry::FailedDownloadCounter() const {
124 return failed_download_counter_; 120 return failed_download_counter_;
125 } 121 }
126 122
127 ReadingListEntry& ReadingListEntry::operator=(ReadingListEntry&& other) { 123 ReadingListEntry& ReadingListEntry::operator=(ReadingListEntry&& other) {
128 url_ = std::move(other.url_); 124 url_ = std::move(other.url_);
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 pb_entry->set_status(sync_pb::ReadingListSpecifics::UNREAD); 361 pb_entry->set_status(sync_pb::ReadingListSpecifics::UNREAD);
366 } 362 }
367 363
368 return pb_entry; 364 return pb_entry;
369 } 365 }
370 366
371 bool ReadingListEntry::CompareEntryUpdateTime(const ReadingListEntry& lhs, 367 bool ReadingListEntry::CompareEntryUpdateTime(const ReadingListEntry& lhs,
372 const ReadingListEntry& rhs) { 368 const ReadingListEntry& rhs) {
373 return lhs.UpdateTime() > rhs.UpdateTime(); 369 return lhs.UpdateTime() > rhs.UpdateTime();
374 } 370 }
OLDNEW
« no previous file with comments | « components/reading_list/reading_list_entry.h ('k') | components/reading_list/reading_list_entry_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698