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" | |
7 #include "base/macros.h" | 8 #include "base/macros.h" |
8 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
9 #include "base/thread_task_runner_handle.h" | 10 #include "base/thread_task_runner_handle.h" |
11 #include "chrome/browser/android/chrome_feature_list.h" | |
10 #include "chrome/browser/image_decoder.h" | 12 #include "chrome/browser/image_decoder.h" |
11 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
12 #include "chrome/browser/search_engines/template_url_service_factory.h" | 14 #include "chrome/browser/search_engines/template_url_service_factory.h" |
13 #include "chrome/browser/search_engines/ui_thread_search_terms_data.h" | 15 #include "chrome/browser/search_engines/ui_thread_search_terms_data.h" |
14 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 16 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
15 #include "components/search_engines/template_url_service.h" | 17 #include "components/search_engines/template_url_service.h" |
16 #include "components/search_provider_logos/google_logo_api.h" | 18 #include "components/search_provider_logos/google_logo_api.h" |
17 #include "content/public/browser/browser_thread.h" | 19 #include "content/public/browser/browser_thread.h" |
18 #include "net/url_request/url_request_context_getter.h" | 20 #include "net/url_request/url_request_context_getter.h" |
19 | 21 |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
118 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE), | 120 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE), |
119 BrowserThread::GetBlockingPool(), profile_->GetRequestContext(), | 121 BrowserThread::GetBlockingPool(), profile_->GetRequestContext(), |
120 std::unique_ptr<search_provider_logos::LogoDelegate>( | 122 std::unique_ptr<search_provider_logos::LogoDelegate>( |
121 new ChromeLogoDelegate()))); | 123 new ChromeLogoDelegate()))); |
122 } | 124 } |
123 | 125 |
124 logo_tracker_->SetServerAPI( | 126 logo_tracker_->SetServerAPI( |
125 GetGoogleDoodleURL(profile_), | 127 GetGoogleDoodleURL(profile_), |
126 base::Bind(&search_provider_logos::GoogleParseLogoResponse), | 128 base::Bind(&search_provider_logos::GoogleParseLogoResponse), |
127 base::Bind(&search_provider_logos::GoogleAppendQueryparamsToLogoURL), | 129 base::Bind(&search_provider_logos::GoogleAppendQueryparamsToLogoURL), |
128 true); | 130 true, |
tschumann
2016/05/10 08:44:34
a comment explaining the semantics of the bools wo
Marc Treib
2016/05/10 08:54:59
Haha, I just made the exact same comment on the ot
atanasova
2016/05/10 09:12:54
Done.
tschumann
2016/05/10 09:19:22
To follow up: In google3 there's a recent trend to
| |
131 base::FeatureList::IsEnabled(chrome::android::kNTPSnippetsFeature)); | |
129 logo_tracker_->GetLogo(observer); | 132 logo_tracker_->GetLogo(observer); |
130 } | 133 } |
131 | 134 |
132 // LogoServiceFactory --------------------------------------------------------- | 135 // LogoServiceFactory --------------------------------------------------------- |
133 | 136 |
134 // static | 137 // static |
135 LogoService* LogoServiceFactory::GetForProfile(Profile* profile) { | 138 LogoService* LogoServiceFactory::GetForProfile(Profile* profile) { |
136 return static_cast<LogoService*>( | 139 return static_cast<LogoService*>( |
137 GetInstance()->GetServiceForBrowserContext(profile, true)); | 140 GetInstance()->GetServiceForBrowserContext(profile, true)); |
138 } | 141 } |
(...skipping 10 matching lines...) Expand all Loading... | |
149 } | 152 } |
150 | 153 |
151 LogoServiceFactory::~LogoServiceFactory() {} | 154 LogoServiceFactory::~LogoServiceFactory() {} |
152 | 155 |
153 KeyedService* LogoServiceFactory::BuildServiceInstanceFor( | 156 KeyedService* LogoServiceFactory::BuildServiceInstanceFor( |
154 content::BrowserContext* context) const { | 157 content::BrowserContext* context) const { |
155 Profile* profile = static_cast<Profile*>(context); | 158 Profile* profile = static_cast<Profile*>(context); |
156 DCHECK(!profile->IsOffTheRecord()); | 159 DCHECK(!profile->IsOffTheRecord()); |
157 return new LogoService(profile); | 160 return new LogoService(profile); |
158 } | 161 } |
OLD | NEW |