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

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: Rebase. Add a TODO. 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 class NTPSnippetsService : public KeyedService { 50 class NTPSnippetsService : public KeyedService {
51 public: 51 public:
52 using ImageFetchedCallback = 52 using ImageFetchedCallback =
53 base::Callback<void(const std::string& snippet_id, const gfx::Image&)>; 53 base::Callback<void(const std::string& snippet_id, const gfx::Image&)>;
54 54
55 // |application_language_code| should be a ISO 639-1 compliant string, e.g. 55 // |application_language_code| should be a ISO 639-1 compliant string, e.g.
56 // 'en' or 'en-US'. Note that this code should only specify the language, not 56 // 'en' or 'en-US'. Note that this code should only specify the language, not
57 // the locale, so 'en_US' (English language with US locale) and 'en-GB_US' 57 // the locale, so 'en_US' (English language with US locale) and 'en-GB_US'
58 // (British English person in the US) are not language codes. 58 // (British English person in the US) are not language codes.
59 NTPSnippetsService( 59 NTPSnippetsService(
60 bool enabled,
60 PrefService* pref_service, 61 PrefService* pref_service,
61 suggestions::SuggestionsService* suggestions_service, 62 suggestions::SuggestionsService* suggestions_service,
62 scoped_refptr<base::SequencedTaskRunner> file_task_runner, 63 scoped_refptr<base::SequencedTaskRunner> file_task_runner,
63 const std::string& application_language_code, 64 const std::string& application_language_code,
64 NTPSnippetsScheduler* scheduler, 65 NTPSnippetsScheduler* scheduler,
65 std::unique_ptr<NTPSnippetsFetcher> snippets_fetcher, 66 std::unique_ptr<NTPSnippetsFetcher> snippets_fetcher,
66 std::unique_ptr<image_fetcher::ImageFetcher> image_fetcher); 67 std::unique_ptr<image_fetcher::ImageFetcher> image_fetcher);
noyau (Ping after 24h) 2016/05/20 11:45:05 7 arguments now. This starts to smell dirty. |ena
Michael van Ouwerkerk 2016/05/20 12:38:36 I've added some documentation to the |enabled_| fi
Marc Treib 2016/05/20 13:49:36 Er, did you? Where?
Michael van Ouwerkerk 2016/05/20 14:56:49 Ah sorry, I didn't upload the docs before. Done no
noyau (Ping after 24h) 2016/05/20 15:16:53 Don't see it. Did you forget to upload?
Marc Treib 2016/05/20 15:30:25 We have a flag (in base::FeatureList) which should
Marc Treib 2016/05/20 15:30:25 Aah, I missed the pref-dependent part of this; I w
Michael van Ouwerkerk 2016/05/24 14:11:31 Eric, there is another CL underway for changing ho
67 ~NTPSnippetsService() override; 68 ~NTPSnippetsService() override;
68 69
69 static void RegisterProfilePrefs(PrefRegistrySimple* registry); 70 static void RegisterProfilePrefs(PrefRegistrySimple* registry);
70 71
71 void Init(bool enabled); 72 void Init();
72 73
73 // Inherited from KeyedService. 74 // Inherited from KeyedService.
74 void Shutdown() override; 75 void Shutdown() override;
75 76
76 // Fetches snippets from the server and adds them to the current ones. 77 // Fetches snippets from the server and adds them to the current ones.
77 void FetchSnippets(); 78 void FetchSnippets();
78 // Fetches snippets from the server for specified hosts (overriding 79 // Fetches snippets from the server for specified hosts (overriding
79 // suggestions from the suggestion service) and adds them to the current ones. 80 // suggestions from the suggestion service) and adds them to the current ones.
80 void FetchSnippetsFromHosts(const std::set<std::string>& hosts); 81 void FetchSnippetsFromHosts(const std::set<std::string>& hosts);
81 82
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 // hosts. (e.g. the user manually removed all MostLikely tiles.) 202 // hosts. (e.g. the user manually removed all MostLikely tiles.)
202 virtual void NTPSnippetsServiceCleared() = 0; 203 virtual void NTPSnippetsServiceCleared() = 0;
203 204
204 protected: 205 protected:
205 virtual ~NTPSnippetsServiceObserver() {} 206 virtual ~NTPSnippetsServiceObserver() {}
206 }; 207 };
207 208
208 } // namespace ntp_snippets 209 } // namespace ntp_snippets
209 210
210 #endif // COMPONENTS_NTP_SNIPPETS_NTP_SNIPPETS_SERVICE_H_ 211 #endif // COMPONENTS_NTP_SNIPPETS_NTP_SNIPPETS_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698