| 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 "components/favicon/core/favicon_service.h" | 12 #include "components/favicon/core/favicon_service.h" |
| 13 #include "components/history/core/browser/history_service.h" | 13 #include "components/history/core/browser/history_service.h" |
| 14 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 14 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
| 15 #include "components/prefs/pref_service.h" | 15 #include "components/prefs/pref_service.h" |
| 16 | 16 |
| 17 namespace { | 17 namespace { |
| 18 | 18 |
| 19 std::unique_ptr<KeyedService> BuildFaviconService( | 19 std::unique_ptr<KeyedService> BuildFaviconService( |
| 20 content::BrowserContext* context) { | 20 content::BrowserContext* context) { |
| 21 Profile* profile = Profile::FromBrowserContext(context); | 21 Profile* profile = Profile::FromBrowserContext(context); |
| 22 return base::WrapUnique(new favicon::FaviconService( | 22 return base::MakeUnique<favicon::FaviconService>( |
| 23 base::WrapUnique(new ChromeFaviconClient(profile)), | 23 base::WrapUnique(new ChromeFaviconClient(profile)), |
| 24 HistoryServiceFactory::GetForProfile( | 24 HistoryServiceFactory::GetForProfile(profile, |
| 25 profile, ServiceAccessType::EXPLICIT_ACCESS))); | 25 ServiceAccessType::EXPLICIT_ACCESS)); |
| 26 } | 26 } |
| 27 | 27 |
| 28 } // namespace | 28 } // namespace |
| 29 | 29 |
| 30 // static | 30 // static |
| 31 favicon::FaviconService* FaviconServiceFactory::GetForProfile( | 31 favicon::FaviconService* FaviconServiceFactory::GetForProfile( |
| 32 Profile* profile, | 32 Profile* profile, |
| 33 ServiceAccessType sat) { | 33 ServiceAccessType sat) { |
| 34 if (!profile->IsOffTheRecord()) { | 34 if (!profile->IsOffTheRecord()) { |
| 35 return static_cast<favicon::FaviconService*>( | 35 return static_cast<favicon::FaviconService*>( |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 } | 68 } |
| 69 | 69 |
| 70 KeyedService* FaviconServiceFactory::BuildServiceInstanceFor( | 70 KeyedService* FaviconServiceFactory::BuildServiceInstanceFor( |
| 71 content::BrowserContext* context) const { | 71 content::BrowserContext* context) const { |
| 72 return BuildFaviconService(context).release(); | 72 return BuildFaviconService(context).release(); |
| 73 } | 73 } |
| 74 | 74 |
| 75 bool FaviconServiceFactory::ServiceIsNULLWhileTesting() const { | 75 bool FaviconServiceFactory::ServiceIsNULLWhileTesting() const { |
| 76 return true; | 76 return true; |
| 77 } | 77 } |
| OLD | NEW |