| 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 #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/favicon/favicon_util.h" |
| 8 #include "chrome/browser/history/history.h" | 9 #include "chrome/browser/history/history.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/common/chrome_constants.h" | 11 #include "chrome/common/chrome_constants.h" |
| 11 #include "chrome/common/chrome_notification_types.h" | 12 #include "chrome/common/chrome_notification_types.h" |
| 12 #include "chrome/common/icon_messages.h" | 13 #include "chrome/common/icon_messages.h" |
| 13 #include "content/public/browser/favicon_status.h" | 14 #include "content/public/browser/favicon_status.h" |
| 14 #include "content/public/browser/invalidate_type.h" | 15 #include "content/public/browser/invalidate_type.h" |
| 15 #include "content/public/browser/navigation_controller.h" | 16 #include "content/public/browser/navigation_controller.h" |
| 16 #include "content/public/browser/navigation_details.h" | 17 #include "content/public/browser/navigation_details.h" |
| 17 #include "content/public/browser/navigation_entry.h" | 18 #include "content/public/browser/navigation_entry.h" |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 const std::vector<FaviconURL>& candidates) { | 133 const std::vector<FaviconURL>& candidates) { |
| 133 favicon_handler_->OnUpdateFaviconURL(page_id, candidates); | 134 favicon_handler_->OnUpdateFaviconURL(page_id, candidates); |
| 134 if (touch_icon_handler_.get()) | 135 if (touch_icon_handler_.get()) |
| 135 touch_icon_handler_->OnUpdateFaviconURL(page_id, candidates); | 136 touch_icon_handler_->OnUpdateFaviconURL(page_id, candidates); |
| 136 } | 137 } |
| 137 | 138 |
| 138 NavigationEntry* FaviconTabHelper::GetActiveEntry() { | 139 NavigationEntry* FaviconTabHelper::GetActiveEntry() { |
| 139 return web_contents()->GetController().GetActiveEntry(); | 140 return web_contents()->GetController().GetActiveEntry(); |
| 140 } | 141 } |
| 141 | 142 |
| 142 void FaviconTabHelper::StartDownload(int id, const GURL& url, int image_size) { | 143 int FaviconTabHelper::StartDownload(const GURL& url, int image_size) { |
| 143 content::RenderViewHost* host = web_contents()->GetRenderViewHost(); | 144 content::RenderViewHost* host = web_contents()->GetRenderViewHost(); |
| 144 host->Send(new IconMsg_DownloadFavicon( | 145 int id = FaviconUtil::DownloadFavicon(host, url, image_size); |
| 145 host->GetRoutingID(), id, url, image_size)); | 146 return id; |
| 146 } | 147 } |
| 147 | 148 |
| 148 void FaviconTabHelper::NotifyFaviconUpdated() { | 149 void FaviconTabHelper::NotifyFaviconUpdated() { |
| 149 content::NotificationService::current()->Notify( | 150 content::NotificationService::current()->Notify( |
| 150 chrome::NOTIFICATION_FAVICON_UPDATED, | 151 chrome::NOTIFICATION_FAVICON_UPDATED, |
| 151 content::Source<WebContents>(web_contents()), | 152 content::Source<WebContents>(web_contents()), |
| 152 content::NotificationService::NoDetails()); | 153 content::NotificationService::NoDetails()); |
| 153 web_contents()->NotifyNavigationStateChanged(content::INVALIDATE_TYPE_TAB); | 154 web_contents()->NotifyNavigationStateChanged(content::INVALIDATE_TYPE_TAB); |
| 154 } | 155 } |
| 155 | 156 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 184 | 185 |
| 185 void FaviconTabHelper::OnDidDownloadFavicon(int id, | 186 void FaviconTabHelper::OnDidDownloadFavicon(int id, |
| 186 const GURL& image_url, | 187 const GURL& image_url, |
| 187 bool errored, | 188 bool errored, |
| 188 const SkBitmap& image) { | 189 const SkBitmap& image) { |
| 189 gfx::Image favicon(image); | 190 gfx::Image favicon(image); |
| 190 favicon_handler_->OnDidDownloadFavicon(id, image_url, errored, favicon); | 191 favicon_handler_->OnDidDownloadFavicon(id, image_url, errored, favicon); |
| 191 if (touch_icon_handler_.get()) | 192 if (touch_icon_handler_.get()) |
| 192 touch_icon_handler_->OnDidDownloadFavicon(id, image_url, errored, favicon); | 193 touch_icon_handler_->OnDidDownloadFavicon(id, image_url, errored, favicon); |
| 193 } | 194 } |
| OLD | NEW |