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

Side by Side Diff: chrome/browser/search/suggestions/suggestions_service.h

Issue 392983007: [Suggestions] Make ThumbnailManager implement ImageManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 CHROME_BROWSER_SEARCH_SUGGESTIONS_SUGGESTIONS_SERVICE_H_ 5 #ifndef CHROME_BROWSER_SEARCH_SUGGESTIONS_SUGGESTIONS_SERVICE_H_
6 #define CHROME_BROWSER_SEARCH_SUGGESTIONS_SUGGESTIONS_SERVICE_H_ 6 #define CHROME_BROWSER_SEARCH_SUGGESTIONS_SUGGESTIONS_SERVICE_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/callback.h" 12 #include "base/callback.h"
13 #include "base/cancelable_callback.h" 13 #include "base/cancelable_callback.h"
14 #include "base/gtest_prod_util.h" 14 #include "base/gtest_prod_util.h"
15 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
16 #include "base/memory/weak_ptr.h" 16 #include "base/memory/weak_ptr.h"
17 #include "base/time/time.h" 17 #include "base/time/time.h"
18 #include "chrome/browser/search/suggestions/image_manager.h"
18 #include "chrome/browser/search/suggestions/proto/suggestions.pb.h" 19 #include "chrome/browser/search/suggestions/proto/suggestions.pb.h"
19 #include "chrome/browser/search/suggestions/thumbnail_manager.h"
20 #include "components/keyed_service/core/keyed_service.h" 20 #include "components/keyed_service/core/keyed_service.h"
21 #include "net/url_request/url_fetcher_delegate.h" 21 #include "net/url_request/url_fetcher_delegate.h"
22 #include "ui/gfx/image/image_skia.h" 22 #include "ui/gfx/image/image_skia.h"
23 #include "url/gurl.h" 23 #include "url/gurl.h"
24 24
25 namespace net { 25 namespace net {
26 class URLRequestContextGetter; 26 class URLRequestContextGetter;
27 } // namespace net 27 } // namespace net
28 28
29 namespace user_prefs { 29 namespace user_prefs {
(...skipping 14 matching lines...) Expand all
44 extern const char kSuggestionsFieldTrialControlParam[]; 44 extern const char kSuggestionsFieldTrialControlParam[];
45 extern const char kSuggestionsFieldTrialStateEnabled[]; 45 extern const char kSuggestionsFieldTrialStateEnabled[];
46 46
47 // An interface to fetch server suggestions asynchronously. 47 // An interface to fetch server suggestions asynchronously.
48 class SuggestionsService : public KeyedService, public net::URLFetcherDelegate { 48 class SuggestionsService : public KeyedService, public net::URLFetcherDelegate {
49 public: 49 public:
50 typedef base::Callback<void(const SuggestionsProfile&)> ResponseCallback; 50 typedef base::Callback<void(const SuggestionsProfile&)> ResponseCallback;
51 51
52 SuggestionsService(net::URLRequestContextGetter* url_request_context, 52 SuggestionsService(net::URLRequestContextGetter* url_request_context,
53 scoped_ptr<SuggestionsStore> suggestions_store, 53 scoped_ptr<SuggestionsStore> suggestions_store,
54 scoped_ptr<ThumbnailManager> thumbnail_manager, 54 scoped_ptr<ImageManager> thumbnail_manager,
55 scoped_ptr<BlacklistStore> blacklist_store); 55 scoped_ptr<BlacklistStore> blacklist_store);
56 virtual ~SuggestionsService(); 56 virtual ~SuggestionsService();
57 57
58 // Whether this service is enabled. 58 // Whether this service is enabled.
59 static bool IsEnabled(); 59 static bool IsEnabled();
60 60
61 // Whether the user is part of a control group. 61 // Whether the user is part of a control group.
62 static bool IsControlGroup(); 62 static bool IsControlGroup();
63 63
64 // Request suggestions data, which will be passed to |callback|. Initiates a 64 // Request suggestions data, which will be passed to |callback|. Initiates a
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 // The URL to fetch suggestions data from. 156 // The URL to fetch suggestions data from.
157 GURL suggestions_url_; 157 GURL suggestions_url_;
158 158
159 // Prefix for building the blacklisting URL. 159 // Prefix for building the blacklisting URL.
160 std::string blacklist_url_prefix_; 160 std::string blacklist_url_prefix_;
161 161
162 // Queue of callbacks. These are flushed when fetch request completes. 162 // Queue of callbacks. These are flushed when fetch request completes.
163 std::vector<ResponseCallback> waiting_requestors_; 163 std::vector<ResponseCallback> waiting_requestors_;
164 164
165 // Used to obtain server thumbnails, if available. 165 // Used to obtain server thumbnails, if available.
166 scoped_ptr<ThumbnailManager> thumbnail_manager_; 166 scoped_ptr<ImageManager> thumbnail_manager_;
huangs 2014/07/16 22:22:24 *If* you're keeping the name "ImageManager", maybe
Mathieu 2014/07/17 16:06:35 Acknowledged.
167 167
168 net::URLRequestContextGetter* url_request_context_; 168 net::URLRequestContextGetter* url_request_context_;
169 169
170 // Delay used when scheduling a blacklisting task. 170 // Delay used when scheduling a blacklisting task.
171 int blacklist_delay_sec_; 171 int blacklist_delay_sec_;
172 172
173 // For callbacks may be run after destruction. 173 // For callbacks may be run after destruction.
174 base::WeakPtrFactory<SuggestionsService> weak_ptr_factory_; 174 base::WeakPtrFactory<SuggestionsService> weak_ptr_factory_;
175 175
176 // Timeout (in ms) before serving requestors after a fetch suggestions request 176 // Timeout (in ms) before serving requestors after a fetch suggestions request
177 // has been issued. 177 // has been issued.
178 int request_timeout_ms_; 178 int request_timeout_ms_;
179 179
180 DISALLOW_COPY_AND_ASSIGN(SuggestionsService); 180 DISALLOW_COPY_AND_ASSIGN(SuggestionsService);
181 }; 181 };
182 182
183 } // namespace suggestions 183 } // namespace suggestions
184 184
185 #endif // CHROME_BROWSER_SEARCH_SUGGESTIONS_SUGGESTIONS_SERVICE_H_ 185 #endif // CHROME_BROWSER_SEARCH_SUGGESTIONS_SUGGESTIONS_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698