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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/callback_forward.h" | 12 #include "base/callback_forward.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "chrome/browser/cancelable_request.h" | 14 #include "chrome/browser/cancelable_request.h" |
15 #include "chrome/browser/favicon/favicon_service.h" | 15 #include "chrome/browser/favicon/favicon_service.h" |
16 #include "chrome/browser/favicon/favicon_tab_helper.h" | 16 #include "chrome/browser/favicon/favicon_tab_helper.h" |
17 #include "chrome/common/favicon_url.h" | 17 #include "chrome/common/favicon_url.h" |
18 #include "chrome/common/ref_counted_util.h" | 18 #include "chrome/common/ref_counted_util.h" |
19 #include "googleurl/src/gurl.h" | 19 #include "googleurl/src/gurl.h" |
20 #include "ui/gfx/favicon_size.h" | 20 #include "ui/gfx/favicon_size.h" |
21 #include "ui/gfx/image/image.h" | 21 #include "ui/gfx/image/image.h" |
22 | 22 |
23 class FaviconHandlerDelegate; | 23 class FaviconHandlerDelegate; |
24 class Profile; | 24 class Profile; |
| 25 class SkBitmap; |
| 26 |
| 27 namespace base { |
25 class RefCountedMemory; | 28 class RefCountedMemory; |
26 class SkBitmap; | 29 } |
27 | 30 |
28 namespace content { | 31 namespace content { |
29 class NavigationEntry; | 32 class NavigationEntry; |
30 } | 33 } |
31 | 34 |
32 // FaviconHandler works with FaviconTabHelper to fetch the specific type of | 35 // FaviconHandler works with FaviconTabHelper to fetch the specific type of |
33 // favicon. | 36 // favicon. |
34 // | 37 // |
35 // FetchFavicon requests the favicon from the favicon service which in turn | 38 // FetchFavicon requests the favicon from the favicon service which in turn |
36 // requests the favicon from the history database. At this point | 39 // requests the favicon from the history database. At this point |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 void SetFavicon(const GURL& url, | 230 void SetFavicon(const GURL& url, |
228 const GURL& icon_url, | 231 const GURL& icon_url, |
229 const gfx::Image& image, | 232 const gfx::Image& image, |
230 history::IconType icon_type); | 233 history::IconType icon_type); |
231 | 234 |
232 // Converts the FAVICON's image data to an SkBitmap and sets it on the | 235 // Converts the FAVICON's image data to an SkBitmap and sets it on the |
233 // NavigationEntry. | 236 // NavigationEntry. |
234 // If the WebContents has a delegate, it is notified of the new favicon | 237 // If the WebContents has a delegate, it is notified of the new favicon |
235 // (INVALIDATE_FAVICON). | 238 // (INVALIDATE_FAVICON). |
236 void UpdateFavicon(content::NavigationEntry* entry, | 239 void UpdateFavicon(content::NavigationEntry* entry, |
237 scoped_refptr<RefCountedMemory> data); | 240 scoped_refptr<base::RefCountedMemory> data); |
238 void UpdateFavicon(content::NavigationEntry* entry, const gfx::Image* image); | 241 void UpdateFavicon(content::NavigationEntry* entry, const gfx::Image* image); |
239 | 242 |
240 // If the image is not already at its preferred size, scales the image such | 243 // If the image is not already at its preferred size, scales the image such |
241 // that either the width and/or height == gfx::kFaviconSize. Does nothing if | 244 // that either the width and/or height == gfx::kFaviconSize. Does nothing if |
242 // the image is empty. | 245 // the image is empty. |
243 gfx::Image ResizeFaviconIfNeeded(const gfx::Image& image); | 246 gfx::Image ResizeFaviconIfNeeded(const gfx::Image& image); |
244 | 247 |
245 void FetchFaviconInternal(); | 248 void FetchFaviconInternal(); |
246 | 249 |
247 // Return the current candidate if any. | 250 // Return the current candidate if any. |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 // This handler's delegate. | 293 // This handler's delegate. |
291 FaviconHandlerDelegate* delegate_; // weak | 294 FaviconHandlerDelegate* delegate_; // weak |
292 | 295 |
293 // Current favicon candidate. | 296 // Current favicon candidate. |
294 FaviconCandidate favicon_candidate_; | 297 FaviconCandidate favicon_candidate_; |
295 | 298 |
296 DISALLOW_COPY_AND_ASSIGN(FaviconHandler); | 299 DISALLOW_COPY_AND_ASSIGN(FaviconHandler); |
297 }; | 300 }; |
298 | 301 |
299 #endif // CHROME_BROWSER_FAVICON_FAVICON_HANDLER_H_ | 302 #endif // CHROME_BROWSER_FAVICON_FAVICON_HANDLER_H_ |
OLD | NEW |