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

Unified Diff: ios/chrome/browser/reading_list/reading_list_entry.h

Issue 2338133010: Add a TimeUntilNextTry to reading list (Closed)
Patch Set: Fix comments and tests Created 4 years, 3 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 | « no previous file | ios/chrome/browser/reading_list/reading_list_entry.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/browser/reading_list/reading_list_entry.h
diff --git a/ios/chrome/browser/reading_list/reading_list_entry.h b/ios/chrome/browser/reading_list/reading_list_entry.h
index aad6cb2aa10cdaebaaf55229626c48781a1c2af0..4e3618ee0064f850e1fb7284094f7106b990762c 100644
--- a/ios/chrome/browser/reading_list/reading_list_entry.h
+++ b/ios/chrome/browser/reading_list/reading_list_entry.h
@@ -8,6 +8,7 @@
#include <string>
#include "base/macros.h"
+#include "net/base/backoff_entry.h"
#include "url/gurl.h"
// An entry in the reading list. The URL is a unique identifier for an entry, as
@@ -16,6 +17,9 @@
class ReadingListEntry {
public:
ReadingListEntry(const GURL& url, const std::string& title);
+ ReadingListEntry(const GURL& url,
+ const std::string& title,
+ std::unique_ptr<net::BackoffEntry> backoff);
ReadingListEntry(ReadingListEntry&& entry);
~ReadingListEntry();
@@ -25,22 +29,28 @@ class ReadingListEntry {
// ERROR where the system will not retry at all.
enum DistillationState { WAITING, PROCESSING, PROCESSED, WILL_RETRY, ERROR };
+ static const net::BackoffEntry::Policy kBackoffPolicy;
+
// The URL of the page the user would like to read later.
const GURL& URL() const;
// The title of the entry. Might be empty.
- const std::string Title() const;
+ const std::string& Title() const;
// What state this entry is in.
DistillationState DistilledState() const;
// The local file URL for the distilled version of the page. This should only
// be called if the state is "PROCESSED".
const GURL& DistilledURL() const;
+ // The time before the next try. This is automatically increased when the
+ // state is set to WILL_RETRY or ERROR from a non-error state.
+ base::TimeDelta TimeUntilNextTry() const;
ReadingListEntry& operator=(ReadingListEntry&& other);
bool operator==(const ReadingListEntry& other) const;
// Sets the title.
void SetTitle(const std::string& title);
- // Sets the distilled URL and switch the state to PROCESSED.
+ // Sets the distilled URL and switch the state to PROCESSED and reset the time
+ // until the next try.
void SetDistilledURL(const GURL& url);
// Sets the state to one of PROCESSING, WILL_RETRY or ERROR.
void SetDistilledState(DistillationState distilled_state);
@@ -50,6 +60,7 @@ class ReadingListEntry {
std::string title_;
GURL distilled_url_;
DistillationState distilled_state_;
+ std::unique_ptr<net::BackoffEntry> backoff_;
DISALLOW_COPY_AND_ASSIGN(ReadingListEntry);
};
« no previous file with comments | « no previous file | ios/chrome/browser/reading_list/reading_list_entry.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698