Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
|
Marc Treib
2016/05/20 14:40:04
nit: We don't update the copyright headers.
markusheintz_
2016/05/23 13:20:47
Done.
| |
| 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_SUGGESTIONS_SUGGESTIONS_SERVICE_H_ | 5 #ifndef COMPONENTS_SUGGESTIONS_SUGGESTIONS_SERVICE_H_ |
| 6 #define COMPONENTS_SUGGESTIONS_SUGGESTIONS_SERVICE_H_ | 6 #define COMPONENTS_SUGGESTIONS_SUGGESTIONS_SERVICE_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 #include <string> | 11 #include <string> |
| 12 | 12 |
| 13 #include "base/callback.h" | 13 #include "base/callback.h" |
| 14 #include "base/callback_list.h" | 14 #include "base/callback_list.h" |
| 15 #include "base/gtest_prod_util.h" | 15 #include "base/gtest_prod_util.h" |
| 16 #include "base/macros.h" | 16 #include "base/macros.h" |
| 17 #include "base/memory/weak_ptr.h" | 17 #include "base/memory/weak_ptr.h" |
| 18 #include "base/scoped_observer.h" | 18 #include "base/scoped_observer.h" |
| 19 #include "base/threading/thread_checker.h" | 19 #include "base/threading/thread_checker.h" |
| 20 #include "base/time/time.h" | 20 #include "base/time/time.h" |
| 21 #include "components/keyed_service/core/keyed_service.h" | 21 #include "components/keyed_service/core/keyed_service.h" |
| 22 #include "components/suggestions/proto/suggestions.pb.h" | 22 #include "components/suggestions/proto/suggestions.pb.h" |
| 23 #include "components/sync_driver/sync_service_observer.h" | 23 #include "components/sync_driver/sync_service_observer.h" |
| 24 #include "net/url_request/url_fetcher_delegate.h" | 24 #include "net/url_request/url_fetcher_delegate.h" |
| 25 #include "url/gurl.h" | 25 #include "url/gurl.h" |
| 26 | 26 |
| 27 namespace gfx { | |
| 28 class Image; | |
| 29 } | |
| 30 | |
| 27 namespace net { | 31 namespace net { |
| 28 class URLRequestContextGetter; | 32 class URLRequestContextGetter; |
| 29 } // namespace net | 33 } // namespace net |
| 30 | 34 |
| 31 namespace sync_driver { | 35 namespace sync_driver { |
| 32 class SyncService; | 36 class SyncService; |
| 33 } | 37 } |
| 34 | 38 |
| 35 namespace user_prefs { | 39 namespace user_prefs { |
| 36 class PrefRegistrySyncable; | 40 class PrefRegistrySyncable; |
| 37 } // namespace user_prefs | 41 } // namespace user_prefs |
| 38 | 42 |
| 39 class OAuth2TokenService; | 43 class OAuth2TokenService; |
| 40 class SigninManagerBase; | 44 class SigninManagerBase; |
| 41 class SkBitmap; | |
| 42 | 45 |
| 43 namespace suggestions { | 46 namespace suggestions { |
| 44 | 47 |
| 45 class BlacklistStore; | 48 class BlacklistStore; |
| 46 class ImageManager; | 49 class ImageManager; |
| 47 class SuggestionsStore; | 50 class SuggestionsStore; |
| 48 | 51 |
| 49 // An interface to fetch server suggestions asynchronously. | 52 // An interface to fetch server suggestions asynchronously. |
| 50 class SuggestionsService : public KeyedService, | 53 class SuggestionsService : public KeyedService, |
| 51 public net::URLFetcherDelegate, | 54 public net::URLFetcherDelegate, |
| 52 public sync_driver::SyncServiceObserver { | 55 public sync_driver::SyncServiceObserver { |
| 53 public: | 56 public: |
| 54 using ResponseCallback = base::Callback<void(const SuggestionsProfile&)>; | 57 using ResponseCallback = base::Callback<void(const SuggestionsProfile&)>; |
| 55 using BitmapCallback = base::Callback<void(const GURL&, const SkBitmap*)>; | 58 using BitmapCallback = base::Callback<void(const GURL&, const gfx::Image&)>; |
| 56 | 59 |
| 57 using ResponseCallbackList = | 60 using ResponseCallbackList = |
| 58 base::CallbackList<void(const SuggestionsProfile&)>; | 61 base::CallbackList<void(const SuggestionsProfile&)>; |
| 59 | 62 |
| 60 SuggestionsService(const SigninManagerBase* signin_manager, | 63 SuggestionsService(const SigninManagerBase* signin_manager, |
| 61 OAuth2TokenService* token_service, | 64 OAuth2TokenService* token_service, |
| 62 sync_driver::SyncService* sync_service, | 65 sync_driver::SyncService* sync_service, |
| 63 net::URLRequestContextGetter* url_request_context, | 66 net::URLRequestContextGetter* url_request_context, |
| 64 std::unique_ptr<SuggestionsStore> suggestions_store, | 67 std::unique_ptr<SuggestionsStore> suggestions_store, |
| 65 std::unique_ptr<ImageManager> thumbnail_manager, | 68 std::unique_ptr<ImageManager> thumbnail_manager, |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 220 | 223 |
| 221 // For callbacks may be run after destruction. | 224 // For callbacks may be run after destruction. |
| 222 base::WeakPtrFactory<SuggestionsService> weak_ptr_factory_; | 225 base::WeakPtrFactory<SuggestionsService> weak_ptr_factory_; |
| 223 | 226 |
| 224 DISALLOW_COPY_AND_ASSIGN(SuggestionsService); | 227 DISALLOW_COPY_AND_ASSIGN(SuggestionsService); |
| 225 }; | 228 }; |
| 226 | 229 |
| 227 } // namespace suggestions | 230 } // namespace suggestions |
| 228 | 231 |
| 229 #endif // COMPONENTS_SUGGESTIONS_SUGGESTIONS_SERVICE_H_ | 232 #endif // COMPONENTS_SUGGESTIONS_SUGGESTIONS_SERVICE_H_ |
| OLD | NEW |