| 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/chrome_notification_types.h" | 7 #include "chrome/browser/chrome_notification_types.h" |
| 8 #include "chrome/browser/favicon/favicon_handler.h" | 8 #include "chrome/browser/favicon/favicon_handler.h" |
| 9 #include "chrome/browser/favicon/favicon_service_factory.h" | 9 #include "chrome/browser/favicon/favicon_service_factory.h" |
| 10 #include "chrome/browser/favicon/favicon_util.h" | 10 #include "chrome/browser/favicon/favicon_util.h" |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 } | 146 } |
| 147 | 147 |
| 148 void FaviconTabHelper::NotifyFaviconUpdated(bool icon_url_changed) { | 148 void FaviconTabHelper::NotifyFaviconUpdated(bool icon_url_changed) { |
| 149 content::NotificationService::current()->Notify( | 149 content::NotificationService::current()->Notify( |
| 150 chrome::NOTIFICATION_FAVICON_UPDATED, | 150 chrome::NOTIFICATION_FAVICON_UPDATED, |
| 151 content::Source<WebContents>(web_contents()), | 151 content::Source<WebContents>(web_contents()), |
| 152 content::Details<bool>(&icon_url_changed)); | 152 content::Details<bool>(&icon_url_changed)); |
| 153 web_contents()->NotifyNavigationStateChanged(content::INVALIDATE_TYPE_TAB); | 153 web_contents()->NotifyNavigationStateChanged(content::INVALIDATE_TYPE_TAB); |
| 154 } | 154 } |
| 155 | 155 |
| 156 bool FaviconTabHelper::IsOffTheRecord() { |
| 157 DCHECK(web_contents()); |
| 158 return web_contents()->GetBrowserContext()->IsOffTheRecord(); |
| 159 } |
| 160 |
| 156 void FaviconTabHelper::DidStartNavigationToPendingEntry( | 161 void FaviconTabHelper::DidStartNavigationToPendingEntry( |
| 157 const GURL& url, | 162 const GURL& url, |
| 158 NavigationController::ReloadType reload_type) { | 163 NavigationController::ReloadType reload_type) { |
| 159 if (reload_type != NavigationController::NO_RELOAD && | 164 if (reload_type != NavigationController::NO_RELOAD && |
| 160 !profile_->IsOffTheRecord()) { | 165 !profile_->IsOffTheRecord()) { |
| 161 FaviconService* favicon_service = FaviconServiceFactory::GetForProfile( | 166 FaviconService* favicon_service = FaviconServiceFactory::GetForProfile( |
| 162 profile_, Profile::IMPLICIT_ACCESS); | 167 profile_, Profile::IMPLICIT_ACCESS); |
| 163 if (favicon_service) { | 168 if (favicon_service) { |
| 164 favicon_service->SetFaviconOutOfDateForPage(url); | 169 favicon_service->SetFaviconOutOfDateForPage(url); |
| 165 if (reload_type == NavigationController::RELOAD_IGNORING_CACHE) | 170 if (reload_type == NavigationController::RELOAD_IGNORING_CACHE) |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 favicon_service->UnableToDownloadFavicon(image_url); | 207 favicon_service->UnableToDownloadFavicon(image_url); |
| 203 } | 208 } |
| 204 | 209 |
| 205 favicon_handler_->OnDidDownloadFavicon( | 210 favicon_handler_->OnDidDownloadFavicon( |
| 206 id, image_url, bitmaps, original_bitmap_sizes); | 211 id, image_url, bitmaps, original_bitmap_sizes); |
| 207 if (touch_icon_handler_.get()) { | 212 if (touch_icon_handler_.get()) { |
| 208 touch_icon_handler_->OnDidDownloadFavicon( | 213 touch_icon_handler_->OnDidDownloadFavicon( |
| 209 id, image_url, bitmaps, original_bitmap_sizes); | 214 id, image_url, bitmaps, original_bitmap_sizes); |
| 210 } | 215 } |
| 211 } | 216 } |
| OLD | NEW |