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

Side by Side Diff: ios/chrome/browser/reading_list/reading_list_entry.h

Issue 2350663003: Make reading list entry movable only (Closed)
Patch Set: indentation 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 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 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/macros.h"
10 #include "url/gurl.h" 11 #include "url/gurl.h"
11 12
12 // An entry in the reading list. The URL is a unique identifier for an entry, as 13 // An entry in the reading list. The URL is a unique identifier for an entry, as
13 // such it should not be empty and is the only thing considered when comparing 14 // such it should not be empty and is the only thing considered when comparing
14 // entries. 15 // entries.
15 class ReadingListEntry { 16 class ReadingListEntry {
16 public: 17 public:
17 ReadingListEntry(const GURL& url, const std::string& title); 18 ReadingListEntry(const GURL& url, const std::string& title);
18 ReadingListEntry(const ReadingListEntry& entry); 19 ReadingListEntry(ReadingListEntry&& entry);
19 ~ReadingListEntry(); 20 ~ReadingListEntry();
20 21
21 // Entries are created in WAITING state. At some point they will be PROCESSING 22 // Entries are created in WAITING state. At some point they will be PROCESSING
22 // into one of the three state: PROCESSED, the only state a distilled URL 23 // into one of the three state: PROCESSED, the only state a distilled URL
23 // would be set, WILL_RETRY, similar to wait, but with exponential delays or 24 // would be set, WILL_RETRY, similar to wait, but with exponential delays or
24 // ERROR where the system will not retry at all. 25 // ERROR where the system will not retry at all.
25 enum DistillationState { WAITING, PROCESSING, PROCESSED, WILL_RETRY, ERROR }; 26 enum DistillationState { WAITING, PROCESSING, PROCESSED, WILL_RETRY, ERROR };
26 27
27 // The URL of the page the user would like to read later. 28 // The URL of the page the user would like to read later.
28 const GURL& URL() const; 29 const GURL& URL() const;
29 // The title of the entry. Might be empty. 30 // The title of the entry. Might be empty.
30 const std::string Title() const; 31 const std::string Title() const;
31 // What state this entry is in. 32 // What state this entry is in.
32 DistillationState DistilledState() const; 33 DistillationState DistilledState() const;
33 // The local file URL for the distilled version of the page. This should only 34 // The local file URL for the distilled version of the page. This should only
34 // be called if the state is "PROCESSED". 35 // be called if the state is "PROCESSED".
35 const GURL& DistilledURL() const; 36 const GURL& DistilledURL() const;
36 37
37 ReadingListEntry& operator=(const ReadingListEntry& other); 38 ReadingListEntry& operator=(ReadingListEntry&& other);
38 bool operator==(const ReadingListEntry& other) const; 39 bool operator==(const ReadingListEntry& other) const;
39 40
40 // Sets the title. 41 // Sets the title.
41 void SetTitle(const std::string& title); 42 void SetTitle(const std::string& title);
42 // Sets the distilled URL and switch the state to PROCESSED. 43 // Sets the distilled URL and switch the state to PROCESSED.
43 void SetDistilledURL(const GURL& url); 44 void SetDistilledURL(const GURL& url);
44 // Sets the state to one of PROCESSING, WILL_RETRY or ERROR. 45 // Sets the state to one of PROCESSING, WILL_RETRY or ERROR.
45 void SetDistilledState(DistillationState distilled_state); 46 void SetDistilledState(DistillationState distilled_state);
46 47
47 private: 48 private:
48 GURL url_; 49 GURL url_;
49 std::string title_; 50 std::string title_;
50 GURL distilled_url_; 51 GURL distilled_url_;
51 DistillationState distilled_state_; 52 DistillationState distilled_state_;
53
54 DISALLOW_COPY_AND_ASSIGN(ReadingListEntry);
52 }; 55 };
53 56
54 #endif // IOS_CHROME_BROWSER_READING_LIST_READING_LIST_ENTRY_H_ 57 #endif // IOS_CHROME_BROWSER_READING_LIST_READING_LIST_ENTRY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698