| 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/bookmarks/bookmark_model_factory.h" | 7 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
| 8 #include "chrome/browser/chrome_notification_types.h" | 8 #include "chrome/browser/chrome_notification_types.h" |
| 9 #include "chrome/browser/favicon/favicon_handler.h" | 9 #include "chrome/browser/favicon/favicon_handler.h" |
| 10 #include "chrome/browser/favicon/favicon_service_factory.h" | 10 #include "chrome/browser/favicon/favicon_service_factory.h" |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 | 184 |
| 185 void FaviconTabHelper::DidNavigateMainFrame( | 185 void FaviconTabHelper::DidNavigateMainFrame( |
| 186 const content::LoadCommittedDetails& details, | 186 const content::LoadCommittedDetails& details, |
| 187 const content::FrameNavigateParams& params) { | 187 const content::FrameNavigateParams& params) { |
| 188 favicon_urls_.clear(); | 188 favicon_urls_.clear(); |
| 189 // Get the favicon, either from history or request it from the net. | 189 // Get the favicon, either from history or request it from the net. |
| 190 FetchFavicon(details.entry->GetURL()); | 190 FetchFavicon(details.entry->GetURL()); |
| 191 } | 191 } |
| 192 | 192 |
| 193 void FaviconTabHelper::DidUpdateFaviconURL( | 193 void FaviconTabHelper::DidUpdateFaviconURL( |
| 194 int32 page_id, | |
| 195 const std::vector<content::FaviconURL>& candidates) { | 194 const std::vector<content::FaviconURL>& candidates) { |
| 196 DCHECK(!candidates.empty()); | 195 DCHECK(!candidates.empty()); |
| 197 favicon_urls_ = candidates; | 196 favicon_urls_ = candidates; |
| 198 | 197 |
| 199 favicon_handler_->OnUpdateFaviconURL(page_id, candidates); | 198 favicon_handler_->OnUpdateFaviconURL(candidates); |
| 200 if (touch_icon_handler_.get()) | 199 if (touch_icon_handler_.get()) |
| 201 touch_icon_handler_->OnUpdateFaviconURL(page_id, candidates); | 200 touch_icon_handler_->OnUpdateFaviconURL(candidates); |
| 202 } | 201 } |
| 203 | 202 |
| 204 FaviconService* FaviconTabHelper::GetFaviconService() { | 203 FaviconService* FaviconTabHelper::GetFaviconService() { |
| 205 return FaviconServiceFactory::GetForProfile(profile_, | 204 return FaviconServiceFactory::GetForProfile(profile_, |
| 206 Profile::EXPLICIT_ACCESS); | 205 Profile::EXPLICIT_ACCESS); |
| 207 } | 206 } |
| 208 | 207 |
| 209 bool FaviconTabHelper::IsBookmarked(const GURL& url) { | 208 bool FaviconTabHelper::IsBookmarked(const GURL& url) { |
| 210 BookmarkModel* bookmark_model = BookmarkModelFactory::GetForProfile(profile_); | 209 BookmarkModel* bookmark_model = BookmarkModelFactory::GetForProfile(profile_); |
| 211 return bookmark_model && bookmark_model->IsBookmarked(url); | 210 return bookmark_model && bookmark_model->IsBookmarked(url); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 226 favicon_service->UnableToDownloadFavicon(image_url); | 225 favicon_service->UnableToDownloadFavicon(image_url); |
| 227 } | 226 } |
| 228 | 227 |
| 229 favicon_handler_->OnDidDownloadFavicon( | 228 favicon_handler_->OnDidDownloadFavicon( |
| 230 id, image_url, bitmaps, original_bitmap_sizes); | 229 id, image_url, bitmaps, original_bitmap_sizes); |
| 231 if (touch_icon_handler_.get()) { | 230 if (touch_icon_handler_.get()) { |
| 232 touch_icon_handler_->OnDidDownloadFavicon( | 231 touch_icon_handler_->OnDidDownloadFavicon( |
| 233 id, image_url, bitmaps, original_bitmap_sizes); | 232 id, image_url, bitmaps, original_bitmap_sizes); |
| 234 } | 233 } |
| 235 } | 234 } |
| OLD | NEW |