| 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 #include "chrome/browser/favicon/favicon_tab_helper.h" | 5 #include "chrome/browser/favicon/favicon_tab_helper.h" |
| 6 | 6 |
| 7 #include "chrome/browser/favicon/favicon_handler.h" | 7 #include "chrome/browser/favicon/favicon_handler.h" |
| 8 #include "chrome/browser/history/history.h" | 8 #include "chrome/browser/history/history.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/common/chrome_constants.h" | 10 #include "chrome/common/chrome_constants.h" |
| 11 #include "chrome/common/chrome_notification_types.h" | 11 #include "chrome/common/chrome_notification_types.h" |
| 12 #include "chrome/common/icon_messages.h" | 12 #include "chrome/common/icon_messages.h" |
| 13 #include "content/browser/renderer_host/render_view_host.h" | 13 #include "content/browser/renderer_host/render_view_host.h" |
| 14 #include "content/browser/tab_contents/tab_contents.h" | 14 #include "content/browser/tab_contents/tab_contents.h" |
| 15 #include "content/browser/webui/web_ui.h" | 15 #include "content/browser/webui/web_ui.h" |
| 16 #include "content/public/browser/favicon_status.h" | 16 #include "content/public/browser/favicon_status.h" |
| 17 #include "content/public/browser/navigation_controller.h" | 17 #include "content/public/browser/navigation_controller.h" |
| 18 #include "content/public/browser/navigation_details.h" | 18 #include "content/public/browser/navigation_details.h" |
| 19 #include "content/public/browser/navigation_entry.h" | 19 #include "content/public/browser/navigation_entry.h" |
| 20 #include "content/public/browser/notification_service.h" | 20 #include "content/public/browser/notification_service.h" |
| 21 #include "content/public/browser/web_contents_delegate.h" | 21 #include "content/public/browser/web_contents_delegate.h" |
| 22 #include "ui/gfx/codec/png_codec.h" | 22 #include "ui/gfx/codec/png_codec.h" |
| 23 #include "ui/gfx/image/image.h" | 23 #include "ui/gfx/image/image.h" |
| 24 | 24 |
| 25 using content::FaviconStatus; | 25 using content::FaviconStatus; |
| 26 using content::NavigationController; | 26 using content::NavigationController; |
| 27 using content::NavigationEntry; | 27 using content::NavigationEntry; |
| 28 using content::WebContents; | 28 using content::WebContents; |
| 29 | 29 |
| 30 FaviconTabHelper::FaviconTabHelper(TabContents* tab_contents) | 30 FaviconTabHelper::FaviconTabHelper(WebContents* web_contents) |
| 31 : content::WebContentsObserver(tab_contents), | 31 : content::WebContentsObserver(web_contents), |
| 32 profile_(Profile::FromBrowserContext(tab_contents->GetBrowserContext())) { | 32 profile_(Profile::FromBrowserContext(web_contents->GetBrowserContext())) { |
| 33 favicon_handler_.reset(new FaviconHandler(profile_, this, | 33 favicon_handler_.reset(new FaviconHandler(profile_, this, |
| 34 FaviconHandler::FAVICON)); | 34 FaviconHandler::FAVICON)); |
| 35 if (chrome::kEnableTouchIcon) | 35 if (chrome::kEnableTouchIcon) |
| 36 touch_icon_handler_.reset(new FaviconHandler(profile_, this, | 36 touch_icon_handler_.reset(new FaviconHandler(profile_, this, |
| 37 FaviconHandler::TOUCH)); | 37 FaviconHandler::TOUCH)); |
| 38 } | 38 } |
| 39 | 39 |
| 40 FaviconTabHelper::~FaviconTabHelper() { | 40 FaviconTabHelper::~FaviconTabHelper() { |
| 41 } | 41 } |
| 42 | 42 |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 | 183 |
| 184 void FaviconTabHelper::OnDidDownloadFavicon(int id, | 184 void FaviconTabHelper::OnDidDownloadFavicon(int id, |
| 185 const GURL& image_url, | 185 const GURL& image_url, |
| 186 bool errored, | 186 bool errored, |
| 187 const SkBitmap& image) { | 187 const SkBitmap& image) { |
| 188 gfx::Image favicon(new SkBitmap(image)); | 188 gfx::Image favicon(new SkBitmap(image)); |
| 189 favicon_handler_->OnDidDownloadFavicon(id, image_url, errored, favicon); | 189 favicon_handler_->OnDidDownloadFavicon(id, image_url, errored, favicon); |
| 190 if (touch_icon_handler_.get()) | 190 if (touch_icon_handler_.get()) |
| 191 touch_icon_handler_->OnDidDownloadFavicon(id, image_url, errored, favicon); | 191 touch_icon_handler_->OnDidDownloadFavicon(id, image_url, errored, favicon); |
| 192 } | 192 } |
| OLD | NEW |