| 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_service_factory.h" | 5 #include "chrome/browser/favicon/favicon_service_factory.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "base/memory/singleton.h" | 8 #include "base/memory/singleton.h" |
| 9 #include "chrome/browser/favicon/chrome_favicon_client.h" | 9 #include "chrome/browser/favicon/chrome_favicon_client.h" |
| 10 #include "chrome/browser/history/history_service_factory.h" | 10 #include "chrome/browser/history/history_service_factory.h" |
| 11 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
| 12 #include "chrome/browser/search/suggestions/image_decoder_impl.h" |
| 12 #include "components/favicon/core/favicon_service.h" | 13 #include "components/favicon/core/favicon_service.h" |
| 13 #include "components/history/core/browser/history_service.h" | 14 #include "components/history/core/browser/history_service.h" |
| 15 #include "components/image_fetcher/image_decoder.h" |
| 16 #include "components/image_fetcher/image_fetcher_impl.h" |
| 14 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 17 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
| 15 #include "components/prefs/pref_service.h" | 18 #include "components/prefs/pref_service.h" |
| 16 | 19 |
| 17 namespace { | 20 namespace { |
| 18 | 21 |
| 19 std::unique_ptr<KeyedService> BuildFaviconService( | 22 std::unique_ptr<KeyedService> BuildFaviconService( |
| 20 content::BrowserContext* context) { | 23 content::BrowserContext* context) { |
| 21 Profile* profile = Profile::FromBrowserContext(context); | 24 Profile* profile = Profile::FromBrowserContext(context); |
| 25 |
| 22 return base::MakeUnique<favicon::FaviconService>( | 26 return base::MakeUnique<favicon::FaviconService>( |
| 23 base::WrapUnique(new ChromeFaviconClient(profile)), | 27 base::WrapUnique(new ChromeFaviconClient(profile)), |
| 24 HistoryServiceFactory::GetForProfile(profile, | 28 HistoryServiceFactory::GetForProfile(profile, |
| 25 ServiceAccessType::EXPLICIT_ACCESS)); | 29 ServiceAccessType::EXPLICIT_ACCESS), |
| 30 base::MakeUnique<image_fetcher::ImageFetcherImpl>( |
| 31 base::MakeUnique<suggestions::ImageDecoderImpl>(), |
| 32 profile->GetRequestContext())); |
| 26 } | 33 } |
| 27 | 34 |
| 28 } // namespace | 35 } // namespace |
| 29 | 36 |
| 30 // static | 37 // static |
| 31 favicon::FaviconService* FaviconServiceFactory::GetForProfile( | 38 favicon::FaviconService* FaviconServiceFactory::GetForProfile( |
| 32 Profile* profile, | 39 Profile* profile, |
| 33 ServiceAccessType sat) { | 40 ServiceAccessType sat) { |
| 34 if (!profile->IsOffTheRecord()) { | 41 if (!profile->IsOffTheRecord()) { |
| 35 return static_cast<favicon::FaviconService*>( | 42 return static_cast<favicon::FaviconService*>( |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 } | 75 } |
| 69 | 76 |
| 70 KeyedService* FaviconServiceFactory::BuildServiceInstanceFor( | 77 KeyedService* FaviconServiceFactory::BuildServiceInstanceFor( |
| 71 content::BrowserContext* context) const { | 78 content::BrowserContext* context) const { |
| 72 return BuildFaviconService(context).release(); | 79 return BuildFaviconService(context).release(); |
| 73 } | 80 } |
| 74 | 81 |
| 75 bool FaviconServiceFactory::ServiceIsNULLWhileTesting() const { | 82 bool FaviconServiceFactory::ServiceIsNULLWhileTesting() const { |
| 76 return true; | 83 return true; |
| 77 } | 84 } |
| OLD | NEW |