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

Unified Diff: components/ntp_snippets/ntp_snippets_service.h

Issue 1958163002: [NTP Snippets] Refactor home-grown container API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Avoided auto as suggested. Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: components/ntp_snippets/ntp_snippets_service.h
diff --git a/components/ntp_snippets/ntp_snippets_service.h b/components/ntp_snippets/ntp_snippets_service.h
index 689e08f477735affbeb60838844b196c4207f36f..4c2b111b50ca90731c8632c20e587602cd809696 100644
--- a/components/ntp_snippets/ntp_snippets_service.h
+++ b/components/ntp_snippets/ntp_snippets_service.h
@@ -18,7 +18,6 @@
#include "base/sequenced_task_runner.h"
#include "base/timer/timer.h"
#include "components/keyed_service/core/keyed_service.h"
-#include "components/ntp_snippets/inner_iterator.h"
#include "components/ntp_snippets/ntp_snippet.h"
#include "components/ntp_snippets/ntp_snippets_fetcher.h"
#include "components/ntp_snippets/ntp_snippets_scheduler.h"
@@ -48,8 +47,6 @@ class NTPSnippetsServiceObserver;
class NTPSnippetsService : public KeyedService {
public:
using NTPSnippetStorage = NTPSnippet::PtrVector;
- using const_iterator =
- InnerIterator<NTPSnippetStorage::const_iterator, const NTPSnippet>;
using ImageFetchedCallback =
base::Callback<void(const GURL&, const SkBitmap*)>;
@@ -81,6 +78,15 @@ class NTPSnippetsService : public KeyedService {
// suggestions from the suggestion service) and adds them to the current ones.
void FetchSnippetsFromHosts(const std::set<std::string>& hosts);
+ // Available snippets.
+ const NTPSnippetStorage& snippets() const { return snippets_; }
+
+ // Returns the list of snippets previously discarded by the user (that are
+ // not expired yet).
+ const NTPSnippetStorage& discarded_snippets() const {
+ return discarded_snippets_;
+ }
+
// Returns the last status message from the snippets fetcher.
const std::string& last_status() const {
return snippets_fetcher_->last_status();
@@ -106,12 +112,6 @@ class NTPSnippetsService : public KeyedService {
// a snippet was discarded.
bool DiscardSnippet(const GURL& url);
- // Returns the list of snippets previously discarded by the user (that are
- // not expired yet).
- const NTPSnippetStorage& discarded_snippets() const {
- return discarded_snippets_;
- }
-
// Clears the lists of snippets previously discarded by the user.
void ClearDiscardedSnippets();
@@ -122,19 +122,6 @@ class NTPSnippetsService : public KeyedService {
void AddObserver(NTPSnippetsServiceObserver* observer);
void RemoveObserver(NTPSnippetsServiceObserver* observer);
- // Number of snippets available.
- size_t size() const { return snippets_.size(); }
-
- // The snippets can be iterated upon only via a const_iterator. Recommended
- // way to iterate is as follows:
- //
- // NTPSnippetsService* service; // Assume is set.
- // for (auto& snippet : *service) {
- // // |snippet| here is a const object.
- // }
- const_iterator begin() const { return const_iterator(snippets_.begin()); }
- const_iterator end() const { return const_iterator(snippets_.end()); }
-
// Returns the maximum number of snippets that will be shown at once.
static int GetMaxSnippetCountForTesting();
« no previous file with comments | « components/ntp_snippets/inner_iterator_unittest.cc ('k') | components/ntp_snippets/ntp_snippets_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698