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 #ifndef CHROME_BROWSER_BITMAP_FETCHER_BITMAP_FETCHER_SERVICE_H_ | 4 #ifndef CHROME_BROWSER_BITMAP_FETCHER_BITMAP_FETCHER_SERVICE_H_ |
5 #define CHROME_BROWSER_BITMAP_FETCHER_BITMAP_FETCHER_SERVICE_H_ | 5 #define CHROME_BROWSER_BITMAP_FETCHER_BITMAP_FETCHER_SERVICE_H_ |
6 | 6 |
7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "base/containers/mru_cache.h" | 8 #include "base/containers/mru_cache.h" |
9 #include "base/containers/scoped_ptr_hash_map.h" | 9 #include "base/containers/scoped_ptr_hash_map.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 public: | 30 public: |
31 typedef int RequestId; | 31 typedef int RequestId; |
32 static const RequestId REQUEST_ID_INVALID = 0; | 32 static const RequestId REQUEST_ID_INVALID = 0; |
33 | 33 |
34 class Observer { | 34 class Observer { |
35 public: | 35 public: |
36 virtual ~Observer() {} | 36 virtual ~Observer() {} |
37 | 37 |
38 // Called whenever the image changes. Called with an empty image if the | 38 // Called whenever the image changes. Called with an empty image if the |
39 // fetch failed or the request ended for any reason. | 39 // fetch failed or the request ended for any reason. |
| 40 // TODO(dschuyler) The comment differs from what the code does, follow-up. |
40 virtual void OnImageChanged(RequestId request_id, | 41 virtual void OnImageChanged(RequestId request_id, |
41 const SkBitmap& answers_image) = 0; | 42 const SkBitmap& answers_image) = 0; |
42 }; | 43 }; |
43 | 44 |
44 explicit BitmapFetcherService(content::BrowserContext* context); | 45 explicit BitmapFetcherService(content::BrowserContext* context); |
45 ~BitmapFetcherService() override; | 46 ~BitmapFetcherService() override; |
46 | 47 |
47 // Cancels a request, if it is still in-flight. | 48 // Cancels a request, if it is still in-flight. |
48 void CancelRequest(RequestId requestId); | 49 void CancelRequest(RequestId requestId); |
49 | 50 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 // Current request ID to be used. | 102 // Current request ID to be used. |
102 int current_request_id_; | 103 int current_request_id_; |
103 | 104 |
104 // Browser context this service is active for. | 105 // Browser context this service is active for. |
105 content::BrowserContext* context_; | 106 content::BrowserContext* context_; |
106 | 107 |
107 DISALLOW_COPY_AND_ASSIGN(BitmapFetcherService); | 108 DISALLOW_COPY_AND_ASSIGN(BitmapFetcherService); |
108 }; | 109 }; |
109 | 110 |
110 #endif // CHROME_BROWSER_BITMAP_FETCHER_BITMAP_FETCHER_SERVICE_H_ | 111 #endif // CHROME_BROWSER_BITMAP_FETCHER_BITMAP_FETCHER_SERVICE_H_ |
OLD | NEW |