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 #include "components/suggestions/image_manager.h" | 5 #include "components/suggestions/image_manager.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "components/suggestions/image_encoder.h" |
8 #include "components/suggestions/image_fetcher.h" | 9 #include "components/suggestions/image_fetcher.h" |
9 | 10 |
10 #if defined(OS_IOS) | |
11 #include "components/suggestions/image_encoder_ios.h" | |
12 #else | |
13 #include "components/suggestions/image_encoder.h" | |
14 #endif | |
15 | |
16 using leveldb_proto::ProtoDatabase; | 11 using leveldb_proto::ProtoDatabase; |
17 | 12 |
18 namespace suggestions { | 13 namespace suggestions { |
19 | 14 |
20 ImageManager::ImageManager() : weak_ptr_factory_(this) {} | 15 ImageManager::ImageManager() : weak_ptr_factory_(this) {} |
21 | 16 |
22 ImageManager::ImageManager(scoped_ptr<ImageFetcher> image_fetcher, | 17 ImageManager::ImageManager(scoped_ptr<ImageFetcher> image_fetcher, |
23 scoped_ptr<ProtoDatabase<ImageData> > database, | 18 scoped_ptr<ProtoDatabase<ImageData> > database, |
24 const base::FilePath& database_dir) | 19 const base::FilePath& database_dir) |
25 : image_fetcher_(image_fetcher.Pass()), | 20 : image_fetcher_(image_fetcher.Pass()), |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 it != pending_cache_requests_.end(); ++it) { | 197 it != pending_cache_requests_.end(); ++it) { |
203 const ImageCacheRequest& request = it->second; | 198 const ImageCacheRequest& request = it->second; |
204 for (CallbackVector::const_iterator callback_it = request.callbacks.begin(); | 199 for (CallbackVector::const_iterator callback_it = request.callbacks.begin(); |
205 callback_it != request.callbacks.end(); ++callback_it) { | 200 callback_it != request.callbacks.end(); ++callback_it) { |
206 ServeFromCacheOrNetwork(request.url, request.image_url, *callback_it); | 201 ServeFromCacheOrNetwork(request.url, request.image_url, *callback_it); |
207 } | 202 } |
208 } | 203 } |
209 } | 204 } |
210 | 205 |
211 } // namespace suggestions | 206 } // namespace suggestions |
OLD | NEW |