| 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" |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 NavigationController::ReloadType reload_type) { | 150 NavigationController::ReloadType reload_type) { |
| 151 if (reload_type != NavigationController::NO_RELOAD && | 151 if (reload_type != NavigationController::NO_RELOAD && |
| 152 !profile_->IsOffTheRecord()) { | 152 !profile_->IsOffTheRecord()) { |
| 153 FaviconService* favicon_service = | 153 FaviconService* favicon_service = |
| 154 profile_->GetFaviconService(Profile::IMPLICIT_ACCESS); | 154 profile_->GetFaviconService(Profile::IMPLICIT_ACCESS); |
| 155 if (favicon_service) | 155 if (favicon_service) |
| 156 favicon_service->SetFaviconOutOfDateForPage(url); | 156 favicon_service->SetFaviconOutOfDateForPage(url); |
| 157 } | 157 } |
| 158 } | 158 } |
| 159 | 159 |
| 160 void FaviconTabHelper::DidNavigateMainFramePostCommit( | 160 void FaviconTabHelper::DidNavigateMainFrame( |
| 161 const content::LoadCommittedDetails& details, | 161 const content::LoadCommittedDetails& details, |
| 162 const ViewHostMsg_FrameNavigate_Params& params) { | 162 const ViewHostMsg_FrameNavigate_Params& params) { |
| 163 // Get the favicon, either from history or request it from the net. | 163 // Get the favicon, either from history or request it from the net. |
| 164 FetchFavicon(details.entry->url()); | 164 FetchFavicon(details.entry->url()); |
| 165 } | 165 } |
| 166 | 166 |
| 167 bool FaviconTabHelper::OnMessageReceived(const IPC::Message& message) { | 167 bool FaviconTabHelper::OnMessageReceived(const IPC::Message& message) { |
| 168 bool message_handled = true; | 168 bool message_handled = true; |
| 169 IPC_BEGIN_MESSAGE_MAP(FaviconTabHelper, message) | 169 IPC_BEGIN_MESSAGE_MAP(FaviconTabHelper, message) |
| 170 IPC_MESSAGE_HANDLER(IconHostMsg_DidDownloadFavicon, OnDidDownloadFavicon) | 170 IPC_MESSAGE_HANDLER(IconHostMsg_DidDownloadFavicon, OnDidDownloadFavicon) |
| 171 IPC_MESSAGE_HANDLER(IconHostMsg_UpdateFaviconURL, OnUpdateFaviconURL) | 171 IPC_MESSAGE_HANDLER(IconHostMsg_UpdateFaviconURL, OnUpdateFaviconURL) |
| 172 IPC_MESSAGE_UNHANDLED(message_handled = false) | 172 IPC_MESSAGE_UNHANDLED(message_handled = false) |
| 173 IPC_END_MESSAGE_MAP() | 173 IPC_END_MESSAGE_MAP() |
| 174 return message_handled; | 174 return message_handled; |
| 175 } | 175 } |
| 176 | 176 |
| 177 void FaviconTabHelper::OnDidDownloadFavicon(int id, | 177 void FaviconTabHelper::OnDidDownloadFavicon(int id, |
| 178 const GURL& image_url, | 178 const GURL& image_url, |
| 179 bool errored, | 179 bool errored, |
| 180 const SkBitmap& image) { | 180 const SkBitmap& image) { |
| 181 gfx::Image favicon(new SkBitmap(image)); | 181 gfx::Image favicon(new SkBitmap(image)); |
| 182 favicon_handler_->OnDidDownloadFavicon(id, image_url, errored, favicon); | 182 favicon_handler_->OnDidDownloadFavicon(id, image_url, errored, favicon); |
| 183 if (touch_icon_handler_.get()) | 183 if (touch_icon_handler_.get()) |
| 184 touch_icon_handler_->OnDidDownloadFavicon(id, image_url, errored, favicon); | 184 touch_icon_handler_->OnDidDownloadFavicon(id, image_url, errored, favicon); |
| 185 } | 185 } |
| OLD | NEW |