OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/android/logo_service.h" | 5 #include "chrome/browser/android/logo_service.h" |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
9 #include "base/threading/sequenced_worker_pool.h" | 9 #include "base/threading/sequenced_worker_pool.h" |
10 #include "base/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 | 102 |
103 LogoService::~LogoService() { | 103 LogoService::~LogoService() { |
104 } | 104 } |
105 | 105 |
106 void LogoService::GetLogo(search_provider_logos::LogoObserver* observer) { | 106 void LogoService::GetLogo(search_provider_logos::LogoObserver* observer) { |
107 TemplateURLService* template_url_service = | 107 TemplateURLService* template_url_service = |
108 TemplateURLServiceFactory::GetForProfile(profile_); | 108 TemplateURLServiceFactory::GetForProfile(profile_); |
109 if (!template_url_service) | 109 if (!template_url_service) |
110 return; | 110 return; |
111 | 111 |
112 TemplateURL* template_url = template_url_service->GetDefaultSearchProvider(); | 112 const TemplateURL* template_url = |
| 113 template_url_service->GetDefaultSearchProvider(); |
113 if (!template_url || !template_url->url_ref().HasGoogleBaseURLs( | 114 if (!template_url || !template_url->url_ref().HasGoogleBaseURLs( |
114 template_url_service->search_terms_data())) | 115 template_url_service->search_terms_data())) |
115 return; | 116 return; |
116 | 117 |
117 if (!logo_tracker_) { | 118 if (!logo_tracker_) { |
118 logo_tracker_.reset(new LogoTracker( | 119 logo_tracker_.reset(new LogoTracker( |
119 profile_->GetPath().Append(kCachedLogoDirectory), | 120 profile_->GetPath().Append(kCachedLogoDirectory), |
120 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE), | 121 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE), |
121 BrowserThread::GetBlockingPool(), profile_->GetRequestContext(), | 122 BrowserThread::GetBlockingPool(), profile_->GetRequestContext(), |
122 std::unique_ptr<search_provider_logos::LogoDelegate>( | 123 std::unique_ptr<search_provider_logos::LogoDelegate>( |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 } | 155 } |
155 | 156 |
156 LogoServiceFactory::~LogoServiceFactory() {} | 157 LogoServiceFactory::~LogoServiceFactory() {} |
157 | 158 |
158 KeyedService* LogoServiceFactory::BuildServiceInstanceFor( | 159 KeyedService* LogoServiceFactory::BuildServiceInstanceFor( |
159 content::BrowserContext* context) const { | 160 content::BrowserContext* context) const { |
160 Profile* profile = static_cast<Profile*>(context); | 161 Profile* profile = static_cast<Profile*>(context); |
161 DCHECK(!profile->IsOffTheRecord()); | 162 DCHECK(!profile->IsOffTheRecord()); |
162 return new LogoService(profile); | 163 return new LogoService(profile); |
163 } | 164 } |
OLD | NEW |