| 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/feature_list.h" | |
| 8 #include "base/macros.h" | 7 #include "base/macros.h" |
| 9 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
| 10 #include "base/threading/thread_task_runner_handle.h" | 9 #include "base/threading/thread_task_runner_handle.h" |
| 11 #include "chrome/browser/android/chrome_feature_list.h" | |
| 12 #include "chrome/browser/image_decoder.h" | 10 #include "chrome/browser/image_decoder.h" |
| 13 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
| 14 #include "chrome/browser/search_engines/template_url_service_factory.h" | 12 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 15 #include "chrome/browser/search_engines/ui_thread_search_terms_data.h" | 13 #include "chrome/browser/search_engines/ui_thread_search_terms_data.h" |
| 16 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 14 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
| 17 #include "components/search_engines/template_url_service.h" | 15 #include "components/search_engines/template_url_service.h" |
| 18 #include "components/search_provider_logos/google_logo_api.h" | 16 #include "components/search_provider_logos/google_logo_api.h" |
| 19 #include "content/public/browser/browser_thread.h" | 17 #include "content/public/browser/browser_thread.h" |
| 20 #include "net/url_request/url_request_context_getter.h" | 18 #include "net/url_request/url_request_context_getter.h" |
| 21 | 19 |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 BrowserThread::GetBlockingPool(), profile_->GetRequestContext(), | 119 BrowserThread::GetBlockingPool(), profile_->GetRequestContext(), |
| 122 std::unique_ptr<search_provider_logos::LogoDelegate>( | 120 std::unique_ptr<search_provider_logos::LogoDelegate>( |
| 123 new ChromeLogoDelegate()))); | 121 new ChromeLogoDelegate()))); |
| 124 } | 122 } |
| 125 | 123 |
| 126 logo_tracker_->SetServerAPI( | 124 logo_tracker_->SetServerAPI( |
| 127 GetGoogleDoodleURL(profile_), | 125 GetGoogleDoodleURL(profile_), |
| 128 base::Bind(&search_provider_logos::GoogleParseLogoResponse), | 126 base::Bind(&search_provider_logos::GoogleParseLogoResponse), |
| 129 base::Bind(&search_provider_logos::GoogleAppendQueryparamsToLogoURL), | 127 base::Bind(&search_provider_logos::GoogleAppendQueryparamsToLogoURL), |
| 130 true, /* wants_cta */ | 128 true, /* wants_cta */ |
| 131 base::FeatureList::IsEnabled(chrome::android::kNTPMaterialDesign)); | 129 true /* transparent */); |
| 132 logo_tracker_->GetLogo(observer); | 130 logo_tracker_->GetLogo(observer); |
| 133 } | 131 } |
| 134 | 132 |
| 135 // LogoServiceFactory --------------------------------------------------------- | 133 // LogoServiceFactory --------------------------------------------------------- |
| 136 | 134 |
| 137 // static | 135 // static |
| 138 LogoService* LogoServiceFactory::GetForProfile(Profile* profile) { | 136 LogoService* LogoServiceFactory::GetForProfile(Profile* profile) { |
| 139 return static_cast<LogoService*>( | 137 return static_cast<LogoService*>( |
| 140 GetInstance()->GetServiceForBrowserContext(profile, true)); | 138 GetInstance()->GetServiceForBrowserContext(profile, true)); |
| 141 } | 139 } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 152 } | 150 } |
| 153 | 151 |
| 154 LogoServiceFactory::~LogoServiceFactory() {} | 152 LogoServiceFactory::~LogoServiceFactory() {} |
| 155 | 153 |
| 156 KeyedService* LogoServiceFactory::BuildServiceInstanceFor( | 154 KeyedService* LogoServiceFactory::BuildServiceInstanceFor( |
| 157 content::BrowserContext* context) const { | 155 content::BrowserContext* context) const { |
| 158 Profile* profile = static_cast<Profile*>(context); | 156 Profile* profile = static_cast<Profile*>(context); |
| 159 DCHECK(!profile->IsOffTheRecord()); | 157 DCHECK(!profile->IsOffTheRecord()); |
| 160 return new LogoService(profile); | 158 return new LogoService(profile); |
| 161 } | 159 } |
| OLD | NEW |