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

Side by Side Diff: components/reading_list/ios/reading_list_entry.h

Issue 2647763005: Store the distilled_url in Reading List entry in Reading List on iOS. (Closed)
Patch Set: feedback Created 3 years, 11 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 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 #ifndef COMPONENTS_READING_LIST_IOS_READING_LIST_ENTRY_H_ 5 #ifndef COMPONENTS_READING_LIST_IOS_READING_LIST_ENTRY_H_
6 #define COMPONENTS_READING_LIST_IOS_READING_LIST_ENTRY_H_ 6 #define COMPONENTS_READING_LIST_IOS_READING_LIST_ENTRY_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 52
53 // The URL of the page the user would like to read later. 53 // The URL of the page the user would like to read later.
54 const GURL& URL() const; 54 const GURL& URL() const;
55 // The title of the entry. Might be empty. 55 // The title of the entry. Might be empty.
56 const std::string& Title() const; 56 const std::string& Title() const;
57 // What state this entry is in. 57 // What state this entry is in.
58 DistillationState DistilledState() const; 58 DistillationState DistilledState() const;
59 // The local file path for the distilled version of the page. This should only 59 // The local file path for the distilled version of the page. This should only
60 // be called if the state is "PROCESSED". 60 // be called if the state is "PROCESSED".
61 const base::FilePath& DistilledPath() const; 61 const base::FilePath& DistilledPath() const;
62 // The URL that has been distilled to produce file stored at |DistilledPath|.
63 const GURL& DistilledURL() const;
62 // The time before the next try. This is automatically increased when the 64 // The time before the next try. This is automatically increased when the
63 // state is set to WILL_RETRY or ERROR from a non-error state. 65 // state is set to WILL_RETRY or ERROR from a non-error state.
64 base::TimeDelta TimeUntilNextTry() const; 66 base::TimeDelta TimeUntilNextTry() const;
65 // The number of time chrome failed to download this entry. This is 67 // The number of time chrome failed to download this entry. This is
66 // automatically increased when the state is set to WILL_RETRY or ERROR from a 68 // automatically increased when the state is set to WILL_RETRY or ERROR from a
67 // non-error state. 69 // non-error state.
68 int FailedDownloadCounter() const; 70 int FailedDownloadCounter() const;
69 // The read status of the entry. 71 // The read status of the entry.
70 bool IsRead() const; 72 bool IsRead() const;
71 // Returns if an entry has ever been seen. 73 // Returns if an entry has ever been seen.
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 // ReadingListStore.CompareEntriesForSync(other.AsReadingListSpecifics(), 119 // ReadingListStore.CompareEntriesForSync(other.AsReadingListSpecifics(),
118 // new_this.AsReadingListSpecifics()). 120 // new_this.AsReadingListSpecifics()).
119 void MergeWithEntry(const ReadingListEntry& other); 121 void MergeWithEntry(const ReadingListEntry& other);
120 122
121 ReadingListEntry& operator=(ReadingListEntry&& other); 123 ReadingListEntry& operator=(ReadingListEntry&& other);
122 124
123 bool operator==(const ReadingListEntry& other) const; 125 bool operator==(const ReadingListEntry& other) const;
124 126
125 // Sets the title. 127 // Sets the title.
126 void SetTitle(const std::string& title); 128 void SetTitle(const std::string& title);
127 // Sets the distilled URL and switch the state to PROCESSED and reset the time 129 // Sets the distilled info (offline path and online URL) about distilled page,
128 // until the next try. 130 // switch the state to PROCESSED and reset the time until the next try.
129 void SetDistilledPath(const base::FilePath& path); 131 void SetDistilledInfo(const base::FilePath& path, const GURL& distilled_url);
130 // Sets the state to one of PROCESSING, WILL_RETRY or ERROR. 132 // Sets the state to one of PROCESSING, WILL_RETRY or ERROR.
131 void SetDistilledState(DistillationState distilled_state); 133 void SetDistilledState(DistillationState distilled_state);
132 // Sets the read state of the entry. Will set the UpdateTime of the entry. 134 // Sets the read state of the entry. Will set the UpdateTime of the entry.
133 void SetRead(bool read); 135 void SetRead(bool read);
134 136
135 private: 137 private:
136 enum State { UNSEEN, UNREAD, READ }; 138 enum State { UNSEEN, UNREAD, READ };
137 ReadingListEntry(const GURL& url, 139 ReadingListEntry(const GURL& url,
138 const std::string& title, 140 const std::string& title,
139 State state, 141 State state,
140 int64_t creation_time, 142 int64_t creation_time,
141 int64_t first_read_time, 143 int64_t first_read_time,
142 int64_t update_time, 144 int64_t update_time,
143 int64_t update_title_time, 145 int64_t update_title_time,
144 ReadingListEntry::DistillationState distilled_state, 146 ReadingListEntry::DistillationState distilled_state,
145 const base::FilePath& distilled_path, 147 const base::FilePath& distilled_path,
148 const GURL& distilled_url,
146 int failed_download_counter, 149 int failed_download_counter,
147 std::unique_ptr<net::BackoffEntry> backoff); 150 std::unique_ptr<net::BackoffEntry> backoff);
148 GURL url_; 151 GURL url_;
149 std::string title_; 152 std::string title_;
150 State state_; 153 State state_;
151 base::FilePath distilled_path_; 154 base::FilePath distilled_path_;
155 GURL distilled_url_;
152 DistillationState distilled_state_; 156 DistillationState distilled_state_;
153 157
154 std::unique_ptr<net::BackoffEntry> backoff_; 158 std::unique_ptr<net::BackoffEntry> backoff_;
155 int failed_download_counter_; 159 int failed_download_counter_;
156 160
157 // These value are in microseconds since Jan 1st 1970. They are used for 161 // These value are in microseconds since Jan 1st 1970. They are used for
158 // sorting the entries from the database. They are kept in int64_t to avoid 162 // sorting the entries from the database. They are kept in int64_t to avoid
159 // conversion on each save/read event. 163 // conversion on each save/read event.
160 int64_t creation_time_us_; 164 int64_t creation_time_us_;
161 int64_t first_read_time_us_; 165 int64_t first_read_time_us_;
162 int64_t update_time_us_; 166 int64_t update_time_us_;
163 int64_t update_title_time_us_; 167 int64_t update_title_time_us_;
164 168
165 DISALLOW_COPY_AND_ASSIGN(ReadingListEntry); 169 DISALLOW_COPY_AND_ASSIGN(ReadingListEntry);
166 }; 170 };
167 171
168 #endif // COMPONENTS_READING_LIST_IOS_READING_LIST_ENTRY_H_ 172 #endif // COMPONENTS_READING_LIST_IOS_READING_LIST_ENTRY_H_
OLDNEW
« no previous file with comments | « components/reading_list/ios/proto/reading_list.proto ('k') | components/reading_list/ios/reading_list_entry.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698