OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_FAVICON_FAVICON_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_FAVICON_FAVICON_HANDLER_H_ |
6 #define CHROME_BROWSER_FAVICON_FAVICON_HANDLER_H_ | 6 #define CHROME_BROWSER_FAVICON_FAVICON_HANDLER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/callback_forward.h" | 11 #include "base/callback_forward.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/task/cancelable_task_tracker.h" | 13 #include "base/task/cancelable_task_tracker.h" |
14 #include "chrome/browser/favicon/favicon_service.h" | 14 #include "chrome/browser/favicon/favicon_service.h" |
15 #include "chrome/browser/favicon/favicon_tab_helper.h" | 15 #include "chrome/browser/favicon/favicon_tab_helper.h" |
16 #include "chrome/common/ref_counted_util.h" | 16 #include "chrome/common/ref_counted_util.h" |
17 #include "content/public/common/favicon_url.h" | 17 #include "content/public/common/favicon_url.h" |
18 #include "ui/gfx/favicon_size.h" | 18 #include "ui/gfx/favicon_size.h" |
19 #include "ui/gfx/image/image.h" | 19 #include "ui/gfx/image/image.h" |
20 #include "url/gurl.h" | 20 #include "url/gurl.h" |
21 | 21 |
22 class FaviconDriver; | |
22 class FaviconHandlerDelegate; | 23 class FaviconHandlerDelegate; |
23 class Profile; | 24 class Profile; |
24 class SkBitmap; | 25 class SkBitmap; |
25 | 26 |
26 namespace base { | 27 namespace base { |
27 class RefCountedMemory; | 28 class RefCountedMemory; |
28 } | 29 } |
29 | 30 |
30 namespace content { | 31 namespace content { |
31 class NavigationEntry; | 32 class NavigationEntry; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
77 // NavigationEntry and notifies the database to save the favicon. | 78 // NavigationEntry and notifies the database to save the favicon. |
78 | 79 |
79 class FaviconHandler { | 80 class FaviconHandler { |
80 public: | 81 public: |
81 enum Type { | 82 enum Type { |
82 FAVICON, | 83 FAVICON, |
83 TOUCH, | 84 TOUCH, |
84 }; | 85 }; |
85 | 86 |
86 FaviconHandler(Profile* profile, | 87 FaviconHandler(Profile* profile, |
88 FaviconDriver* driver, | |
87 FaviconHandlerDelegate* delegate, | 89 FaviconHandlerDelegate* delegate, |
88 Type icon_type); | 90 Type icon_type); |
89 virtual ~FaviconHandler(); | 91 virtual ~FaviconHandler(); |
90 | 92 |
91 // Initiates loading the favicon for the specified url. | 93 // Initiates loading the favicon for the specified url. |
92 void FetchFavicon(const GURL& url); | 94 void FetchFavicon(const GURL& url); |
93 | 95 |
94 // Message Handler. Must be public, because also called from | 96 // Message Handler. Must be public, because also called from |
95 // PrerenderContents. Collects the |image_urls| list. | 97 // PrerenderContents. Collects the |image_urls| list. |
96 void OnUpdateFaviconURL(int32 page_id, | 98 void OnUpdateFaviconURL(int32 page_id, |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
279 | 281 |
280 // The prioritized favicon candidates from the page back from the renderer. | 282 // The prioritized favicon candidates from the page back from the renderer. |
281 std::deque<content::FaviconURL> image_urls_; | 283 std::deque<content::FaviconURL> image_urls_; |
282 | 284 |
283 // The FaviconBitmapResults from history. | 285 // The FaviconBitmapResults from history. |
284 std::vector<chrome::FaviconBitmapResult> history_results_; | 286 std::vector<chrome::FaviconBitmapResult> history_results_; |
285 | 287 |
286 // The Profile associated with this handler. | 288 // The Profile associated with this handler. |
287 Profile* profile_; | 289 Profile* profile_; |
288 | 290 |
291 // The driver which implements platform-specific Favicon operations. | |
292 FaviconDriver* driver_; // weak | |
stevenjb
2014/04/08 15:55:57
I haven't seen "Driver" used much in Chrome code,
blundell
2014/04/08 16:01:57
FooDriver is the naming convention for the interfa
| |
293 | |
289 // This handler's delegate. | 294 // This handler's delegate. |
290 FaviconHandlerDelegate* delegate_; // weak | 295 FaviconHandlerDelegate* delegate_; // weak |
291 | 296 |
292 // Best image we've seen so far. As images are downloaded from the page they | 297 // Best image we've seen so far. As images are downloaded from the page they |
293 // are stored here. When there is an exact match, or no more images are | 298 // are stored here. When there is an exact match, or no more images are |
294 // available the favicon service and the NavigationEntry are updated (assuming | 299 // available the favicon service and the NavigationEntry are updated (assuming |
295 // the image is for a favicon). | 300 // the image is for a favicon). |
296 FaviconCandidate best_favicon_candidate_; | 301 FaviconCandidate best_favicon_candidate_; |
297 | 302 |
298 DISALLOW_COPY_AND_ASSIGN(FaviconHandler); | 303 DISALLOW_COPY_AND_ASSIGN(FaviconHandler); |
299 }; | 304 }; |
300 | 305 |
301 #endif // CHROME_BROWSER_FAVICON_FAVICON_HANDLER_H_ | 306 #endif // CHROME_BROWSER_FAVICON_FAVICON_HANDLER_H_ |
OLD | NEW |