Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 IOS_CHROME_BROWSER_READING_LIST_READING_LIST_ENTRY_H_ | 5 #ifndef IOS_CHROME_BROWSER_READING_LIST_READING_LIST_ENTRY_H_ |
| 6 #define IOS_CHROME_BROWSER_READING_LIST_READING_LIST_ENTRY_H_ | 6 #define IOS_CHROME_BROWSER_READING_LIST_READING_LIST_ENTRY_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/files/file_path.h" | |
| 10 #include "base/macros.h" | 11 #include "base/macros.h" |
| 11 #include "net/base/backoff_entry.h" | 12 #include "net/base/backoff_entry.h" |
| 12 #include "url/gurl.h" | 13 #include "url/gurl.h" |
| 13 | 14 |
| 14 // An entry in the reading list. The URL is a unique identifier for an entry, as | 15 // An entry in the reading list. The URL is a unique identifier for an entry, as |
| 15 // such it should not be empty and is the only thing considered when comparing | 16 // such it should not be empty and is the only thing considered when comparing |
| 16 // entries. | 17 // entries. |
| 17 class ReadingListEntry { | 18 class ReadingListEntry { |
| 18 public: | 19 public: |
| 19 ReadingListEntry(const GURL& url, const std::string& title); | 20 ReadingListEntry(const GURL& url, const std::string& title); |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 30 enum DistillationState { WAITING, PROCESSING, PROCESSED, WILL_RETRY, ERROR }; | 31 enum DistillationState { WAITING, PROCESSING, PROCESSED, WILL_RETRY, ERROR }; |
| 31 | 32 |
| 32 static const net::BackoffEntry::Policy kBackoffPolicy; | 33 static const net::BackoffEntry::Policy kBackoffPolicy; |
| 33 | 34 |
| 34 // The URL of the page the user would like to read later. | 35 // The URL of the page the user would like to read later. |
| 35 const GURL& URL() const; | 36 const GURL& URL() const; |
| 36 // The title of the entry. Might be empty. | 37 // The title of the entry. Might be empty. |
| 37 const std::string& Title() const; | 38 const std::string& Title() const; |
| 38 // What state this entry is in. | 39 // What state this entry is in. |
| 39 DistillationState DistilledState() const; | 40 DistillationState DistilledState() const; |
| 40 // The local file URL for the distilled version of the page. This should only | 41 // The local file URL for the distilled version of the page. This should only |
|
jif-google
2016/11/10 15:48:24
s/file URL/filepath/
Olivier
2016/11/10 16:49:10
Done.
| |
| 41 // be called if the state is "PROCESSED". | 42 // be called if the state is "PROCESSED". |
| 42 const GURL& DistilledURL() const; | 43 const base::FilePath& DistilledPath() const; |
| 44 // The URL to the distilled file. | |
| 45 const GURL DistilledURL() const; | |
|
gambard
2016/11/10 16:07:08
Are we still using this?
Olivier
2016/11/10 16:49:10
Yes, to load the page. The meaninq is different.
I
| |
| 43 // The time before the next try. This is automatically increased when the | 46 // The time before the next try. This is automatically increased when the |
| 44 // state is set to WILL_RETRY or ERROR from a non-error state. | 47 // state is set to WILL_RETRY or ERROR from a non-error state. |
| 45 base::TimeDelta TimeUntilNextTry() const; | 48 base::TimeDelta TimeUntilNextTry() const; |
| 46 // The number of time chrome failed to download this entry. This is | 49 // The number of time chrome failed to download this entry. This is |
| 47 // automatically increased when the state is set to WILL_RETRY or ERROR from a | 50 // automatically increased when the state is set to WILL_RETRY or ERROR from a |
| 48 // non-error state. | 51 // non-error state. |
| 49 int FailedDownloadCounter() const; | 52 int FailedDownloadCounter() const; |
| 50 | 53 |
| 51 ReadingListEntry& operator=(ReadingListEntry&& other); | 54 ReadingListEntry& operator=(ReadingListEntry&& other); |
| 52 bool operator==(const ReadingListEntry& other) const; | 55 bool operator==(const ReadingListEntry& other) const; |
| 53 | 56 |
| 54 // Sets the title. | 57 // Sets the title. |
| 55 void SetTitle(const std::string& title); | 58 void SetTitle(const std::string& title); |
| 56 // Sets the distilled URL and switch the state to PROCESSED and reset the time | 59 // Sets the distilled URL and switch the state to PROCESSED and reset the time |
| 57 // until the next try. | 60 // until the next try. |
| 58 void SetDistilledURL(const GURL& url); | 61 void SetDistilledPath(const base::FilePath& url); |
|
jif-google
2016/11/10 15:48:24
s/url/path/
Also, the comment needs to be updated
Olivier
2016/11/10 16:49:10
Done.
| |
| 59 // Sets the state to one of PROCESSING, WILL_RETRY or ERROR. | 62 // Sets the state to one of PROCESSING, WILL_RETRY or ERROR. |
| 60 void SetDistilledState(DistillationState distilled_state); | 63 void SetDistilledState(DistillationState distilled_state); |
| 61 | 64 |
| 62 private: | 65 private: |
| 63 GURL url_; | 66 GURL url_; |
| 64 std::string title_; | 67 std::string title_; |
| 65 GURL distilled_url_; | 68 base::FilePath distilled_path_; |
| 66 DistillationState distilled_state_; | 69 DistillationState distilled_state_; |
| 67 std::unique_ptr<net::BackoffEntry> backoff_; | 70 std::unique_ptr<net::BackoffEntry> backoff_; |
| 68 int failed_download_counter_; | 71 int failed_download_counter_; |
| 69 | 72 |
| 70 DISALLOW_COPY_AND_ASSIGN(ReadingListEntry); | 73 DISALLOW_COPY_AND_ASSIGN(ReadingListEntry); |
| 71 }; | 74 }; |
| 72 | 75 |
| 73 #endif // IOS_CHROME_BROWSER_READING_LIST_READING_LIST_ENTRY_H_ | 76 #endif // IOS_CHROME_BROWSER_READING_LIST_READING_LIST_ENTRY_H_ |
| OLD | NEW |