Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/doodle/doodle_service_factory.h" | 5 #include "chrome/browser/doodle/doodle_service_factory.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| 11 #include "base/time/default_clock.h" | 11 #include "base/time/default_clock.h" |
| 12 #include "base/time/default_tick_clock.h" | 12 #include "base/time/default_tick_clock.h" |
| 13 #include "base/timer/timer.h" | 13 #include "base/timer/timer.h" |
| 14 #include "chrome/browser/android/chrome_feature_list.h" | |
|
fhorschig
2017/03/23 16:25:48
As discussed: ifdef for Desktop.
Marc Treib
2017/03/23 17:16:02
Done.
| |
| 14 #include "chrome/browser/google/google_url_tracker_factory.h" | 15 #include "chrome/browser/google/google_url_tracker_factory.h" |
| 15 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
| 16 #include "components/doodle/doodle_fetcher.h" | 17 #include "components/doodle/doodle_fetcher.h" |
| 17 #include "components/doodle/doodle_fetcher_impl.h" | 18 #include "components/doodle/doodle_fetcher_impl.h" |
| 18 #include "components/doodle/doodle_service.h" | 19 #include "components/doodle/doodle_service.h" |
| 19 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 20 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
| 20 #include "components/prefs/pref_service.h" | 21 #include "components/prefs/pref_service.h" |
| 21 #include "components/safe_json/safe_json_parser.h" | 22 #include "components/safe_json/safe_json_parser.h" |
| 22 | 23 |
| 23 // static | 24 // static |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 39 } | 40 } |
| 40 | 41 |
| 41 DoodleServiceFactory::~DoodleServiceFactory() = default; | 42 DoodleServiceFactory::~DoodleServiceFactory() = default; |
| 42 | 43 |
| 43 KeyedService* DoodleServiceFactory::BuildServiceInstanceFor( | 44 KeyedService* DoodleServiceFactory::BuildServiceInstanceFor( |
| 44 content::BrowserContext* context) const { | 45 content::BrowserContext* context) const { |
| 45 Profile* profile = static_cast<Profile*>(context); | 46 Profile* profile = static_cast<Profile*>(context); |
| 46 // We don't show doodles in incognito profiles (for now?). | 47 // We don't show doodles in incognito profiles (for now?). |
| 47 DCHECK(!profile->IsOffTheRecord()); | 48 DCHECK(!profile->IsOffTheRecord()); |
| 48 | 49 |
| 50 bool use_gray_background = | |
| 51 !base::FeatureList::IsEnabled(chrome::android::kChromeHomeFeature); | |
| 49 auto fetcher = base::MakeUnique<doodle::DoodleFetcherImpl>( | 52 auto fetcher = base::MakeUnique<doodle::DoodleFetcherImpl>( |
| 50 profile->GetRequestContext(), | 53 profile->GetRequestContext(), |
| 51 GoogleURLTrackerFactory::GetForProfile(profile), | 54 GoogleURLTrackerFactory::GetForProfile(profile), |
| 52 base::Bind(&safe_json::SafeJsonParser::Parse)); | 55 base::Bind(&safe_json::SafeJsonParser::Parse), use_gray_background); |
| 53 return new doodle::DoodleService(profile->GetPrefs(), std::move(fetcher), | 56 return new doodle::DoodleService(profile->GetPrefs(), std::move(fetcher), |
| 54 base::MakeUnique<base::OneShotTimer>(), | 57 base::MakeUnique<base::OneShotTimer>(), |
| 55 base::MakeUnique<base::DefaultClock>(), | 58 base::MakeUnique<base::DefaultClock>(), |
| 56 base::MakeUnique<base::DefaultTickClock>()); | 59 base::MakeUnique<base::DefaultTickClock>()); |
| 57 } | 60 } |
| OLD | NEW |