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

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: Removed broken test. 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 7a4571820f20115cfdb7e3544302d0112cc7cc40..827500dcbb2d907080443123dceaa206e046d6b2 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*)>;
@@ -122,18 +119,8 @@ 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()); }
+ // Available snippets.
+ const NTPSnippetStorage& snippets() const { return snippets_; }
Marc Treib 2016/05/10 07:28:50 Not your doing, but the ordering is a bit weird he
mastiz 2016/05/10 07:35:16 Done, moved *after* FetchSnippetsFromHosts(), to s
// 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