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

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

Issue 2436743002: Add GetEntryFromURL method to the ReadingListModel. (Closed)
Patch Set: Fixed test. Created 4 years, 1 month 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_MODEL_IMPL_H_ 5 #ifndef IOS_CHROME_BROWSER_READING_LIST_READING_LIST_MODEL_IMPL_H_
6 #define IOS_CHROME_BROWSER_READING_LIST_READING_LIST_MODEL_IMPL_H_ 6 #define IOS_CHROME_BROWSER_READING_LIST_READING_LIST_MODEL_IMPL_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "components/keyed_service/core/keyed_service.h" 10 #include "components/keyed_service/core/keyed_service.h"
11 #include "ios/chrome/browser/reading_list/reading_list_entry.h" 11 #include "ios/chrome/browser/reading_list/reading_list_entry.h"
12 #include "ios/chrome/browser/reading_list/reading_list_model.h" 12 #include "ios/chrome/browser/reading_list/reading_list_model.h"
13 13
14 class ReadingListModelStorage; 14 class ReadingListModelStorage;
15 15
16 // Concrete implementation of a reading list model using in memory lists. 16 // Concrete implementation of a reading list model using in memory lists.
17 class ReadingListModelImpl : public ReadingListModel, public KeyedService { 17 class ReadingListModelImpl : public ReadingListModel, public KeyedService {
18 public: 18 public:
19 // Initialize a ReadingListModelImpl to load and save data in 19 // Initialize a ReadingListModelImpl to load and save data in
20 // |persistence_layer|. 20 // |persistence_layer|.
21 ReadingListModelImpl(std::unique_ptr<ReadingListModelStorage> storage_layer); 21 ReadingListModelImpl(std::unique_ptr<ReadingListModelStorage> storage_layer);
22 22
23 // Initialize a ReadingListModelImpl without persistence. Data will not be 23 // Initialize a ReadingListModelImpl without persistence. Data will not be
24 // persistent across sessions. 24 // persistent across sessions.
25 ReadingListModelImpl(); 25 ReadingListModelImpl();
26 26
27 ~ReadingListModelImpl() override; 27 ~ReadingListModelImpl() override;
28
29 // KeyedService implementation.
28 void Shutdown() override; 30 void Shutdown() override;
29 31
32 // ReadingListModel implementation.
30 bool loaded() const override; 33 bool loaded() const override;
31 34
32 size_t unread_size() const override; 35 size_t unread_size() const override;
33 size_t read_size() const override; 36 size_t read_size() const override;
34 37
35 bool HasUnseenEntries() const override; 38 bool HasUnseenEntries() const override;
36 void ResetUnseenEntries() override; 39 void ResetUnseenEntries() override;
37 40
38 // Returns a specific entry.
39 const ReadingListEntry& GetUnreadEntryAtIndex(size_t index) const override; 41 const ReadingListEntry& GetUnreadEntryAtIndex(size_t index) const override;
40 const ReadingListEntry& GetReadEntryAtIndex(size_t index) const override; 42 const ReadingListEntry& GetReadEntryAtIndex(size_t index) const override;
41 43
44 const ReadingListEntry* GetEntryFromURL(const GURL& gurl) const override;
45
42 bool CallbackEntryURL( 46 bool CallbackEntryURL(
43 const GURL& url, 47 const GURL& url,
44 base::Callback<void(const ReadingListEntry&)> callback) const override; 48 base::Callback<void(const ReadingListEntry&)> callback) const override;
45 49
46 void RemoveEntryByUrl(const GURL& url) override; 50 void RemoveEntryByUrl(const GURL& url) override;
47 51
48 const ReadingListEntry& AddEntry(const GURL& url, 52 const ReadingListEntry& AddEntry(const GURL& url,
49 const std::string& title) override; 53 const std::string& title) override;
50 54
51 void MarkReadByURL(const GURL& url) override; 55 void MarkReadByURL(const GURL& url) override;
(...skipping 15 matching lines...) Expand all
67 ReadingListEntries unread_; 71 ReadingListEntries unread_;
68 ReadingListEntries read_; 72 ReadingListEntries read_;
69 std::unique_ptr<ReadingListModelStorage> storageLayer_; 73 std::unique_ptr<ReadingListModelStorage> storageLayer_;
70 bool hasUnseen_; 74 bool hasUnseen_;
71 bool loaded_; 75 bool loaded_;
72 76
73 DISALLOW_COPY_AND_ASSIGN(ReadingListModelImpl); 77 DISALLOW_COPY_AND_ASSIGN(ReadingListModelImpl);
74 }; 78 };
75 79
76 #endif // IOS_CHROME_BROWSER_READING_LIST_READING_LIST_MODEL_MEMORY_H_ 80 #endif // IOS_CHROME_BROWSER_READING_LIST_READING_LIST_MODEL_MEMORY_H_
OLDNEW
« no previous file with comments | « ios/chrome/browser/reading_list/reading_list_model.h ('k') | ios/chrome/browser/reading_list/reading_list_model_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698