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

Side by Side Diff: components/offline_pages/content/suggested_articles_observer.h

Issue 2848703004: Switch SupportsUserData uses to use unique_ptr. (Closed)
Patch Set: rev Created 3 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 unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 COMPONENTS_OFFLINE_PAGES_CONTENT_SUGGESTED_ARTICLES_OBSERVER_H_ 5 #ifndef COMPONENTS_OFFLINE_PAGES_CONTENT_SUGGESTED_ARTICLES_OBSERVER_H_
6 #define COMPONENTS_OFFLINE_PAGES_CONTENT_SUGGESTED_ARTICLES_OBSERVER_H_ 6 #define COMPONENTS_OFFLINE_PAGES_CONTENT_SUGGESTED_ARTICLES_OBSERVER_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 10 matching lines...) Expand all
21 } 21 }
22 22
23 namespace offline_pages { 23 namespace offline_pages {
24 24
25 // Observes the ContentSuggestionsService, listening for new suggestions in the 25 // Observes the ContentSuggestionsService, listening for new suggestions in the
26 // ARTICLES category. When those suggestions arrive, it then forwards them to 26 // ARTICLES category. When those suggestions arrive, it then forwards them to
27 // the Prefetch Service, which does not know about Content Suggestions 27 // the Prefetch Service, which does not know about Content Suggestions
28 // specifically. 28 // specifically.
29 class SuggestedArticlesObserver 29 class SuggestedArticlesObserver
30 : public ntp_snippets::ContentSuggestionsService::Observer, 30 : public ntp_snippets::ContentSuggestionsService::Observer,
31 base::SupportsUserData::Data { 31 public base::SupportsUserData::Data {
32 public: 32 public:
33 // Delegate exists to allow for dependency injection in unit tests. 33 // Delegate exists to allow for dependency injection in unit tests.
34 // SuggestedArticlesObserver implements its own delegate, |DefaultDelegate| in 34 // SuggestedArticlesObserver implements its own delegate, |DefaultDelegate| in
35 // the .cc file that forwards to the ContentSuggestionsService and the 35 // the .cc file that forwards to the ContentSuggestionsService and the
36 // PrefetchServiceFactory. Code inside |DefaultDelegate| should be as simple 36 // PrefetchServiceFactory. Code inside |DefaultDelegate| should be as simple
37 // as possible, since it will only be covered by instrumentation/browser 37 // as possible, since it will only be covered by instrumentation/browser
38 // tests. 38 // tests.
39 class Delegate { 39 class Delegate {
40 public: 40 public:
41 virtual const std::vector<ntp_snippets::ContentSuggestion>& GetSuggestions( 41 virtual const std::vector<ntp_snippets::ContentSuggestion>& GetSuggestions(
(...skipping 29 matching lines...) Expand all
71 ntp_snippets::CategoryStatus category_status_ = 71 ntp_snippets::CategoryStatus category_status_ =
72 ntp_snippets::CategoryStatus::INITIALIZING; 72 ntp_snippets::CategoryStatus::INITIALIZING;
73 std::unique_ptr<Delegate> delegate_; 73 std::unique_ptr<Delegate> delegate_;
74 74
75 DISALLOW_COPY_AND_ASSIGN(SuggestedArticlesObserver); 75 DISALLOW_COPY_AND_ASSIGN(SuggestedArticlesObserver);
76 }; 76 };
77 77
78 } // namespace offline_pages 78 } // namespace offline_pages
79 79
80 #endif // COMPONENTS_OFFLINE_PAGES_CONTENT_SUGGESTED_ARTICLES_OBSERVER_H_ 80 #endif // COMPONENTS_OFFLINE_PAGES_CONTENT_SUGGESTED_ARTICLES_OBSERVER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698