| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_HELPER_H__ | 5 #ifndef CHROME_BROWSER_FAVICON_HELPER_H__ |
| 6 #define CHROME_BROWSER_FAVICON_HELPER_H__ | 6 #define CHROME_BROWSER_FAVICON_HELPER_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.h" | 12 #include "base/callback.h" |
| 13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 14 #include "chrome/browser/favicon_service.h" | 14 #include "chrome/browser/favicon_service.h" |
| 15 #include "chrome/common/icon_messages.h" | 15 #include "chrome/common/favicon_url.h" |
| 16 #include "chrome/common/ref_counted_util.h" | 16 #include "chrome/common/ref_counted_util.h" |
| 17 #include "content/browser/cancelable_request.h" | 17 #include "content/browser/cancelable_request.h" |
| 18 #include "content/browser/tab_contents/tab_contents_observer.h" | 18 #include "content/browser/tab_contents/tab_contents_observer.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 | 21 |
| 22 class NavigationEntry; | 22 class NavigationEntry; |
| 23 class Profile; | 23 class Profile; |
| 24 class RefCountedMemory; | 24 class RefCountedMemory; |
| 25 class SkBitmap; | 25 class SkBitmap; |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 const GURL& image_url, | 149 const GURL& image_url, |
| 150 ImageDownloadCallback* callback, | 150 ImageDownloadCallback* callback, |
| 151 history::IconType icon_type); | 151 history::IconType icon_type); |
| 152 | 152 |
| 153 GURL url; | 153 GURL url; |
| 154 GURL image_url; | 154 GURL image_url; |
| 155 ImageDownloadCallback* callback; | 155 ImageDownloadCallback* callback; |
| 156 history::IconType icon_type; | 156 history::IconType icon_type; |
| 157 }; | 157 }; |
| 158 | 158 |
| 159 static bool do_url_and_icon_match(const FaviconURL& favicon_url, | |
| 160 const GURL& url, | |
| 161 history::IconType icon_type) { | |
| 162 return favicon_url.icon_url == url && | |
| 163 favicon_url.icon_type == static_cast<IconType>(icon_type); | |
| 164 } | |
| 165 | |
| 166 // Returns history::IconType the given icon_type corresponds to. | |
| 167 static history::IconType ToHistoryIconType(IconType icon_type); | |
| 168 | |
| 169 // TabContentsObserver overrides. | 159 // TabContentsObserver overrides. |
| 170 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 160 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 171 | 161 |
| 172 void OnDidDownloadFavicon(int id, | 162 void OnDidDownloadFavicon(int id, |
| 173 const GURL& image_url, | 163 const GURL& image_url, |
| 174 bool errored, | 164 bool errored, |
| 175 const SkBitmap& image); | 165 const SkBitmap& image); |
| 176 | 166 |
| 177 // See description above class for details. | 167 // See description above class for details. |
| 178 void OnFaviconDataForInitialURL(FaviconService::Handle handle, | 168 void OnFaviconDataForInitialURL(FaviconService::Handle handle, |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 // The current candidate's index in urls_. | 249 // The current candidate's index in urls_. |
| 260 size_t current_url_index_; | 250 size_t current_url_index_; |
| 261 | 251 |
| 262 // The FaviconData from history. | 252 // The FaviconData from history. |
| 263 history::FaviconData history_icon_; | 253 history::FaviconData history_icon_; |
| 264 | 254 |
| 265 DISALLOW_COPY_AND_ASSIGN(FaviconHelper); | 255 DISALLOW_COPY_AND_ASSIGN(FaviconHelper); |
| 266 }; | 256 }; |
| 267 | 257 |
| 268 #endif // CHROME_BROWSER_FAVICON_HELPER_H__ | 258 #endif // CHROME_BROWSER_FAVICON_HELPER_H__ |
| OLD | NEW |