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

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

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 #include "ios/chrome/browser/reading_list/reading_list_entry.h" 5 #include "ios/chrome/browser/reading_list/reading_list_entry.h"
6 6
7 ReadingListEntry::ReadingListEntry(const GURL& url, const std::string& title) 7 ReadingListEntry::ReadingListEntry(const GURL& url, const std::string& title)
8 : url_(url), title_(title), distilled_state_(WAITING) { 8 : url_(url), title_(title), distilled_state_(WAITING) {
9 DCHECK(!url.is_empty()); 9 DCHECK(!url.is_empty());
10 DCHECK(url.is_valid()); 10 DCHECK(url.is_valid());
11 } 11 }
12 ReadingListEntry::ReadingListEntry(const ReadingListEntry& entry) 12 ReadingListEntry::ReadingListEntry(ReadingListEntry&& entry)
13 : url_(entry.URL()), 13 : url_(entry.URL()),
14 title_(entry.Title()), 14 title_(entry.Title()),
15 distilled_url_(entry.DistilledURL()), 15 distilled_url_(entry.DistilledURL()),
16 distilled_state_(entry.DistilledState()) {} 16 distilled_state_(entry.DistilledState()) {}
17 ReadingListEntry::~ReadingListEntry() {} 17 ReadingListEntry::~ReadingListEntry() {}
18 18
19 const GURL& ReadingListEntry::URL() const { 19 const GURL& ReadingListEntry::URL() const {
20 return url_; 20 return url_;
21 } 21 }
22 22
23 const std::string ReadingListEntry::Title() const { 23 const std::string ReadingListEntry::Title() const {
24 return title_; 24 return title_;
25 } 25 }
26 26
27 ReadingListEntry::DistillationState ReadingListEntry::DistilledState() const { 27 ReadingListEntry::DistillationState ReadingListEntry::DistilledState() const {
28 return distilled_state_; 28 return distilled_state_;
29 } 29 }
30 30
31 const GURL& ReadingListEntry::DistilledURL() const { 31 const GURL& ReadingListEntry::DistilledURL() const {
32 return distilled_url_; 32 return distilled_url_;
33 } 33 }
34 34
35 ReadingListEntry& ReadingListEntry::operator=(const ReadingListEntry& other) { 35 ReadingListEntry& ReadingListEntry::operator=(ReadingListEntry&& other) {
36 url_ = other.url_; 36 url_ = other.url_;
37 title_ = other.title_; 37 title_ = other.title_;
38 distilled_url_ = other.distilled_url_; 38 distilled_url_ = other.distilled_url_;
39 distilled_state_ = other.distilled_state_; 39 distilled_state_ = other.distilled_state_;
40 return *this; 40 return *this;
41 } 41 }
42 42
43 bool ReadingListEntry::operator==(const ReadingListEntry& other) const { 43 bool ReadingListEntry::operator==(const ReadingListEntry& other) const {
44 return url_ == other.url_; 44 return url_ == other.url_;
45 } 45 }
46 46
47 void ReadingListEntry::SetTitle(const std::string& title) { 47 void ReadingListEntry::SetTitle(const std::string& title) {
48 title_ = title; 48 title_ = title;
49 } 49 }
50 50
51 void ReadingListEntry::SetDistilledURL(const GURL& url) { 51 void ReadingListEntry::SetDistilledURL(const GURL& url) {
52 DCHECK(url.is_valid()); 52 DCHECK(url.is_valid());
53 distilled_url_ = url; 53 distilled_url_ = url;
54 distilled_state_ = PROCESSED; 54 distilled_state_ = PROCESSED;
55 } 55 }
56 56
57 void ReadingListEntry::SetDistilledState(DistillationState distilled_state) { 57 void ReadingListEntry::SetDistilledState(DistillationState distilled_state) {
58 DCHECK(distilled_state != PROCESSED); // use SetDistilledURL instead. 58 DCHECK(distilled_state != PROCESSED); // use SetDistilledURL instead.
59 DCHECK(distilled_state != WAITING); 59 DCHECK(distilled_state != WAITING);
60 distilled_state_ = distilled_state; 60 distilled_state_ = distilled_state;
61 distilled_url_ = GURL(); 61 distilled_url_ = GURL();
62 } 62 }
OLDNEW
« no previous file with comments | « ios/chrome/browser/reading_list/reading_list_entry.h ('k') | ios/chrome/browser/reading_list/reading_list_entry_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698