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

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

Issue 2707043002: [Reading List iOS] Store distillation date and size. (Closed)
Patch Set: done Created 3 years, 10 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
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|. 62 // The URL that has been distilled to produce file stored at |DistilledPath|.
63 const GURL& DistilledURL() const; 63 const GURL& DistilledURL() const;
64 // The time distillation was done. The value is in microseconds since Jan 1st
65 // 1970.
66 int64_t DistillationTime() const;
67 // The size of the stored page in bytes.
68 int64_t DistillationSize() const;
64 // The time before the next try. This is automatically increased when the 69 // The time before the next try. This is automatically increased when the
65 // state is set to WILL_RETRY or ERROR from a non-error state. 70 // state is set to WILL_RETRY or ERROR from a non-error state.
66 base::TimeDelta TimeUntilNextTry() const; 71 base::TimeDelta TimeUntilNextTry() const;
67 // The number of time chrome failed to download this entry. This is 72 // The number of time chrome failed to download this entry. This is
68 // automatically increased when the state is set to WILL_RETRY or ERROR from a 73 // automatically increased when the state is set to WILL_RETRY or ERROR from a
69 // non-error state. 74 // non-error state.
70 int FailedDownloadCounter() const; 75 int FailedDownloadCounter() const;
71 // The read status of the entry. 76 // The read status of the entry.
72 bool IsRead() const; 77 bool IsRead() const;
73 // Returns if an entry has ever been seen. 78 // Returns if an entry has ever been seen.
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 // ReadingListStore.CompareEntriesForSync(other.AsReadingListSpecifics(), 124 // ReadingListStore.CompareEntriesForSync(other.AsReadingListSpecifics(),
120 // new_this.AsReadingListSpecifics()). 125 // new_this.AsReadingListSpecifics()).
121 void MergeWithEntry(const ReadingListEntry& other); 126 void MergeWithEntry(const ReadingListEntry& other);
122 127
123 ReadingListEntry& operator=(ReadingListEntry&& other); 128 ReadingListEntry& operator=(ReadingListEntry&& other);
124 129
125 bool operator==(const ReadingListEntry& other) const; 130 bool operator==(const ReadingListEntry& other) const;
126 131
127 // Sets the title. 132 // Sets the title.
128 void SetTitle(const std::string& title); 133 void SetTitle(const std::string& title);
129 // Sets the distilled info (offline path and online URL) about distilled page, 134 // Sets the distilled info (offline path, online URL, size and date of the
130 // switch the state to PROCESSED and reset the time until the next try. 135 // stored files) about distilled page, switch the state to PROCESSED and reset
131 void SetDistilledInfo(const base::FilePath& path, const GURL& distilled_url); 136 // the time until the next try.
137 void SetDistilledInfo(const base::FilePath& path,
138 const GURL& distilled_url,
139 int64_t distilation_size,
140 int64_t distilation_time);
132 // Sets the state to one of PROCESSING, WILL_RETRY or ERROR. 141 // Sets the state to one of PROCESSING, WILL_RETRY or ERROR.
133 void SetDistilledState(DistillationState distilled_state); 142 void SetDistilledState(DistillationState distilled_state);
134 // Sets the read state of the entry. Will set the UpdateTime of the entry. 143 // Sets the read state of the entry. Will set the UpdateTime of the entry.
135 void SetRead(bool read); 144 void SetRead(bool read);
136 145
137 private: 146 private:
138 enum State { UNSEEN, UNREAD, READ }; 147 enum State { UNSEEN, UNREAD, READ };
139 ReadingListEntry(const GURL& url, 148 ReadingListEntry(const GURL& url,
140 const std::string& title, 149 const std::string& title,
141 State state, 150 State state,
142 int64_t creation_time, 151 int64_t creation_time,
143 int64_t first_read_time, 152 int64_t first_read_time,
144 int64_t update_time, 153 int64_t update_time,
145 int64_t update_title_time, 154 int64_t update_title_time,
146 ReadingListEntry::DistillationState distilled_state, 155 ReadingListEntry::DistillationState distilled_state,
147 const base::FilePath& distilled_path, 156 const base::FilePath& distilled_path,
148 const GURL& distilled_url, 157 const GURL& distilled_url,
158 int64_t distillation_time,
159 int64_t distillation_size,
149 int failed_download_counter, 160 int failed_download_counter,
150 std::unique_ptr<net::BackoffEntry> backoff); 161 std::unique_ptr<net::BackoffEntry> backoff);
151 GURL url_; 162 GURL url_;
152 std::string title_; 163 std::string title_;
153 State state_; 164 State state_;
154 base::FilePath distilled_path_; 165 base::FilePath distilled_path_;
155 GURL distilled_url_; 166 GURL distilled_url_;
156 DistillationState distilled_state_; 167 DistillationState distilled_state_;
157 168
158 std::unique_ptr<net::BackoffEntry> backoff_; 169 std::unique_ptr<net::BackoffEntry> backoff_;
159 int failed_download_counter_; 170 int failed_download_counter_;
160 171
161 // These value are in microseconds since Jan 1st 1970. They are used for 172 // These value are in microseconds since Jan 1st 1970. They are used for
162 // sorting the entries from the database. They are kept in int64_t to avoid 173 // sorting the entries from the database. They are kept in int64_t to avoid
163 // conversion on each save/read event. 174 // conversion on each save/read event.
164 int64_t creation_time_us_; 175 int64_t creation_time_us_;
165 int64_t first_read_time_us_; 176 int64_t first_read_time_us_;
166 int64_t update_time_us_; 177 int64_t update_time_us_;
167 int64_t update_title_time_us_; 178 int64_t update_title_time_us_;
179 int64_t distillation_time_us_;
180 int64_t distillation_size_;
168 181
169 DISALLOW_COPY_AND_ASSIGN(ReadingListEntry); 182 DISALLOW_COPY_AND_ASSIGN(ReadingListEntry);
170 }; 183 };
171 184
172 #endif // COMPONENTS_READING_LIST_IOS_READING_LIST_ENTRY_H_ 185 #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