| 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_utils.h" | 5 #include "chrome/browser/favicon/favicon_utils.h" |
| 6 | 6 |
| 7 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | |
| 8 #include "chrome/browser/favicon/favicon_service_factory.h" | 7 #include "chrome/browser/favicon/favicon_service_factory.h" |
| 9 #include "chrome/browser/history/history_service_factory.h" | 8 #include "chrome/browser/history/history_service_factory.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 11 #include "chrome/browser/search/search.h" | 10 #include "chrome/browser/search/search.h" |
| 12 #include "chrome/common/url_constants.h" | 11 #include "chrome/common/url_constants.h" |
| 13 #include "components/favicon/content/content_favicon_driver.h" | 12 #include "components/favicon/content/content_favicon_driver.h" |
| 14 #include "content/public/browser/navigation_controller.h" | 13 #include "content/public/browser/navigation_controller.h" |
| 15 #include "content/public/browser/navigation_entry.h" | 14 #include "content/public/browser/navigation_entry.h" |
| 16 #include "content/public/common/favicon_url.h" | 15 #include "content/public/common/favicon_url.h" |
| 17 #include "ui/gfx/image/image.h" | 16 #include "ui/gfx/image/image.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 31 void CreateContentFaviconDriverForWebContents( | 30 void CreateContentFaviconDriverForWebContents( |
| 32 content::WebContents* web_contents) { | 31 content::WebContents* web_contents) { |
| 33 DCHECK(web_contents); | 32 DCHECK(web_contents); |
| 34 if (ContentFaviconDriver::FromWebContents(web_contents)) | 33 if (ContentFaviconDriver::FromWebContents(web_contents)) |
| 35 return; | 34 return; |
| 36 | 35 |
| 37 Profile* original_profile = | 36 Profile* original_profile = |
| 38 Profile::FromBrowserContext(web_contents->GetBrowserContext()) | 37 Profile::FromBrowserContext(web_contents->GetBrowserContext()) |
| 39 ->GetOriginalProfile(); | 38 ->GetOriginalProfile(); |
| 40 return ContentFaviconDriver::CreateForWebContents( | 39 return ContentFaviconDriver::CreateForWebContents( |
| 41 web_contents, FaviconServiceFactory::GetForProfile( | 40 web_contents, |
| 42 original_profile, ServiceAccessType::IMPLICIT_ACCESS), | 41 FaviconServiceFactory::GetForProfile(original_profile, |
| 42 ServiceAccessType::IMPLICIT_ACCESS), |
| 43 HistoryServiceFactory::GetForProfile(original_profile, | 43 HistoryServiceFactory::GetForProfile(original_profile, |
| 44 ServiceAccessType::IMPLICIT_ACCESS), | 44 ServiceAccessType::IMPLICIT_ACCESS)); |
| 45 BookmarkModelFactory::GetForBrowserContextIfExists(original_profile)); | |
| 46 } | 45 } |
| 47 | 46 |
| 48 bool ShouldDisplayFavicon(content::WebContents* web_contents) { | 47 bool ShouldDisplayFavicon(content::WebContents* web_contents) { |
| 49 // No favicon on interstitials. This check must be done first since | 48 // No favicon on interstitials. This check must be done first since |
| 50 // interstitial navigations don't commit and always have a pending entry. | 49 // interstitial navigations don't commit and always have a pending entry. |
| 51 if (web_contents->ShowingInterstitialPage()) | 50 if (web_contents->ShowingInterstitialPage()) |
| 52 return false; | 51 return false; |
| 53 | 52 |
| 54 // Always display a throbber during pending loads. | 53 // Always display a throbber during pending loads. |
| 55 const content::NavigationController& controller = | 54 const content::NavigationController& controller = |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 kDesaturateLightness}; | 86 kDesaturateLightness}; |
| 88 return gfx::Image(gfx::ImageSkiaOperations::CreateHSLShiftedImage( | 87 return gfx::Image(gfx::ImageSkiaOperations::CreateHSLShiftedImage( |
| 89 *favicon.ToImageSkia(), shift)); | 88 *favicon.ToImageSkia(), shift)); |
| 90 } | 89 } |
| 91 } | 90 } |
| 92 | 91 |
| 93 return favicon; | 92 return favicon; |
| 94 } | 93 } |
| 95 | 94 |
| 96 } // namespace favicon | 95 } // namespace favicon |
| OLD | NEW |