| OLD | NEW |
| 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 COMPONENTS_SUGGESTIONS_IMAGE_MANAGER_H_ | 5 #ifndef COMPONENTS_SUGGESTIONS_IMAGE_MANAGER_H_ |
| 6 #define COMPONENTS_SUGGESTIONS_IMAGE_MANAGER_H_ | 6 #define COMPONENTS_SUGGESTIONS_IMAGE_MANAGER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 typedef std::vector<ImageData> ImageDataVector; | 40 typedef std::vector<ImageData> ImageDataVector; |
| 41 | 41 |
| 42 ImageManager(scoped_ptr<ImageFetcher> image_fetcher, | 42 ImageManager(scoped_ptr<ImageFetcher> image_fetcher, |
| 43 scoped_ptr<leveldb_proto::ProtoDatabase<ImageData>> database, | 43 scoped_ptr<leveldb_proto::ProtoDatabase<ImageData>> database, |
| 44 const base::FilePath& database_dir, | 44 const base::FilePath& database_dir, |
| 45 scoped_refptr<base::TaskRunner> background_task_runner); | 45 scoped_refptr<base::TaskRunner> background_task_runner); |
| 46 ~ImageManager() override; | 46 ~ImageManager() override; |
| 47 | 47 |
| 48 virtual void Initialize(const SuggestionsProfile& suggestions); | 48 virtual void Initialize(const SuggestionsProfile& suggestions); |
| 49 | 49 |
| 50 void AddImageURL(const GURL& url, const GURL& image_url); |
| 51 |
| 50 // Should be called from the UI thread. | 52 // Should be called from the UI thread. |
| 51 virtual void GetImageForURL( | 53 virtual void GetImageForURL( |
| 52 const GURL& url, | 54 const GURL& url, |
| 53 base::Callback<void(const GURL&, const SkBitmap*)> callback); | 55 base::Callback<void(const GURL&, const SkBitmap*)> callback); |
| 54 | 56 |
| 55 protected: | 57 protected: |
| 56 // Perform additional tasks when an image has been fetched. | 58 // Perform additional tasks when an image has been fetched. |
| 57 void OnImageFetched(const GURL& url, const SkBitmap* bitmap) override; | 59 void OnImageFetched(const GURL& url, const SkBitmap* bitmap) override; |
| 58 | 60 |
| 59 private: | 61 private: |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 base::ThreadChecker thread_checker_; | 148 base::ThreadChecker thread_checker_; |
| 147 | 149 |
| 148 base::WeakPtrFactory<ImageManager> weak_ptr_factory_; | 150 base::WeakPtrFactory<ImageManager> weak_ptr_factory_; |
| 149 | 151 |
| 150 DISALLOW_COPY_AND_ASSIGN(ImageManager); | 152 DISALLOW_COPY_AND_ASSIGN(ImageManager); |
| 151 }; | 153 }; |
| 152 | 154 |
| 153 } // namespace suggestions | 155 } // namespace suggestions |
| 154 | 156 |
| 155 #endif // COMPONENTS_SUGGESTIONS_IMAGE_MANAGER_H_ | 157 #endif // COMPONENTS_SUGGESTIONS_IMAGE_MANAGER_H_ |
| OLD | NEW |