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

Side by Side Diff: components/ntp_snippets/ntp_snippets_service.h

Issue 1997473004: Snippets are enabled when search suggestions are enabled. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix ios. 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_NTP_SNIPPETS_NTP_SNIPPETS_SERVICE_H_ 5 #ifndef COMPONENTS_NTP_SNIPPETS_NTP_SNIPPETS_SERVICE_H_
6 #define COMPONENTS_NTP_SNIPPETS_NTP_SNIPPETS_SERVICE_H_ 6 #define COMPONENTS_NTP_SNIPPETS_NTP_SNIPPETS_SERVICE_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 class NTPSnippetsService : public KeyedService { 47 class NTPSnippetsService : public KeyedService {
48 public: 48 public:
49 using ImageFetchedCallback = 49 using ImageFetchedCallback =
50 base::Callback<void(const std::string& snippet_id, const SkBitmap*)>; 50 base::Callback<void(const std::string& snippet_id, const SkBitmap*)>;
51 51
52 // |application_language_code| should be a ISO 639-1 compliant string, e.g. 52 // |application_language_code| should be a ISO 639-1 compliant string, e.g.
53 // 'en' or 'en-US'. Note that this code should only specify the language, not 53 // 'en' or 'en-US'. Note that this code should only specify the language, not
54 // the locale, so 'en_US' (English language with US locale) and 'en-GB_US' 54 // the locale, so 'en_US' (English language with US locale) and 'en-GB_US'
55 // (British English person in the US) are not language codes. 55 // (British English person in the US) are not language codes.
56 NTPSnippetsService( 56 NTPSnippetsService(
57 bool enabled,
57 PrefService* pref_service, 58 PrefService* pref_service,
58 suggestions::SuggestionsService* suggestions_service, 59 suggestions::SuggestionsService* suggestions_service,
59 scoped_refptr<base::SequencedTaskRunner> file_task_runner, 60 scoped_refptr<base::SequencedTaskRunner> file_task_runner,
60 const std::string& application_language_code, 61 const std::string& application_language_code,
61 NTPSnippetsScheduler* scheduler, 62 NTPSnippetsScheduler* scheduler,
62 std::unique_ptr<NTPSnippetsFetcher> snippets_fetcher, 63 std::unique_ptr<NTPSnippetsFetcher> snippets_fetcher,
63 std::unique_ptr<image_fetcher::ImageFetcher> image_fetcher); 64 std::unique_ptr<image_fetcher::ImageFetcher> image_fetcher);
64 ~NTPSnippetsService() override; 65 ~NTPSnippetsService() override;
65 66
66 static void RegisterProfilePrefs(PrefRegistrySimple* registry); 67 static void RegisterProfilePrefs(PrefRegistrySimple* registry);
67 68
68 void Init(bool enabled); 69 void Init();
69 70
70 // Inherited from KeyedService. 71 // Inherited from KeyedService.
71 void Shutdown() override; 72 void Shutdown() override;
72 73
73 // Fetches snippets from the server and adds them to the current ones. 74 // Fetches snippets from the server and adds them to the current ones.
74 void FetchSnippets(); 75 void FetchSnippets();
75 // Fetches snippets from the server for specified hosts (overriding 76 // Fetches snippets from the server for specified hosts (overriding
76 // suggestions from the suggestion service) and adds them to the current ones. 77 // suggestions from the suggestion service) and adds them to the current ones.
77 void FetchSnippetsFromHosts(const std::set<std::string>& hosts); 78 void FetchSnippetsFromHosts(const std::set<std::string>& hosts);
78 79
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 // hosts. (e.g. the user manually removed all MostLikely tiles.) 205 // hosts. (e.g. the user manually removed all MostLikely tiles.)
205 virtual void NTPSnippetsServiceCleared() = 0; 206 virtual void NTPSnippetsServiceCleared() = 0;
206 207
207 protected: 208 protected:
208 virtual ~NTPSnippetsServiceObserver() {} 209 virtual ~NTPSnippetsServiceObserver() {}
209 }; 210 };
210 211
211 } // namespace ntp_snippets 212 } // namespace ntp_snippets
212 213
213 #endif // COMPONENTS_NTP_SNIPPETS_NTP_SNIPPETS_SERVICE_H_ 214 #endif // COMPONENTS_NTP_SNIPPETS_NTP_SNIPPETS_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698