Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(56)

Side by Side Diff: chrome/browser/doodle/doodle_service_factory.cc

Issue 2768333002: [Doodle] Pass parameters to the server endpoint (Closed)
Patch Set: test Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | components/doodle/doodle_fetcher_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 }
OLDNEW
« no previous file with comments | « no previous file | components/doodle/doodle_fetcher_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698