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

Side by Side Diff: chrome/browser/ntp_snippets/ntp_snippets_service_factory.cc

Issue 2061803002: 📰 The Status card reports disabled sync states (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@simplifyBridge
Patch Set: yolo: another big bag of changes Created 4 years, 5 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/ntp_snippets/ntp_snippets_service_factory.h" 5 #include "chrome/browser/ntp_snippets/ntp_snippets_service_factory.h"
6 6
7 #include "base/feature_list.h" 7 #include "base/feature_list.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/memory/singleton.h" 10 #include "base/memory/singleton.h"
11 #include "chrome/browser/browser_process.h" 11 #include "chrome/browser/browser_process.h"
12 #include "chrome/browser/profiles/profile.h" 12 #include "chrome/browser/profiles/profile.h"
13 #include "chrome/browser/search/suggestions/image_decoder_impl.h" 13 #include "chrome/browser/search/suggestions/image_decoder_impl.h"
14 #include "chrome/browser/search/suggestions/image_fetcher_impl.h" 14 #include "chrome/browser/search/suggestions/image_fetcher_impl.h"
15 #include "chrome/browser/search/suggestions/suggestions_service_factory.h" 15 #include "chrome/browser/search/suggestions/suggestions_service_factory.h"
16 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" 16 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
17 #include "chrome/browser/signin/signin_manager_factory.h" 17 #include "chrome/browser/signin/signin_manager_factory.h"
18 #include "chrome/browser/sync/profile_sync_service_factory.h" 18 #include "chrome/browser/sync/profile_sync_service_factory.h"
19 #include "chrome/common/channel_info.h" 19 #include "chrome/common/channel_info.h"
20 #include "chrome/common/pref_names.h" 20 #include "chrome/common/pref_names.h"
21 #include "components/browser_sync/browser/profile_sync_service.h" 21 #include "components/browser_sync/browser/profile_sync_service.h"
22 #include "components/image_fetcher/image_decoder.h" 22 #include "components/image_fetcher/image_decoder.h"
23 #include "components/image_fetcher/image_fetcher.h" 23 #include "components/image_fetcher/image_fetcher.h"
24 #include "components/keyed_service/content/browser_context_dependency_manager.h" 24 #include "components/keyed_service/content/browser_context_dependency_manager.h"
25 #include "components/ntp_snippets/ntp_snippets_constants.h" 25 #include "components/ntp_snippets/ntp_snippets_constants.h"
26 #include "components/ntp_snippets/ntp_snippets_database.h" 26 #include "components/ntp_snippets/ntp_snippets_database.h"
27 #include "components/ntp_snippets/ntp_snippets_fetcher.h" 27 #include "components/ntp_snippets/ntp_snippets_fetcher.h"
28 #include "components/ntp_snippets/ntp_snippets_scheduler.h" 28 #include "components/ntp_snippets/ntp_snippets_scheduler.h"
29 #include "components/ntp_snippets/ntp_snippets_service.h" 29 #include "components/ntp_snippets/ntp_snippets_service.h"
30 #include "components/ntp_snippets/ntp_snippets_status_service.h"
30 #include "components/prefs/pref_service.h" 31 #include "components/prefs/pref_service.h"
31 #include "components/safe_json/safe_json_parser.h" 32 #include "components/safe_json/safe_json_parser.h"
32 #include "components/signin/core/browser/profile_oauth2_token_service.h" 33 #include "components/signin/core/browser/profile_oauth2_token_service.h"
33 #include "components/signin/core/browser/signin_manager.h" 34 #include "components/signin/core/browser/signin_manager.h"
34 #include "components/version_info/version_info.h" 35 #include "components/version_info/version_info.h"
35 #include "content/public/browser/browser_context.h" 36 #include "content/public/browser/browser_context.h"
36 #include "content/public/browser/browser_thread.h" 37 #include "content/public/browser/browser_thread.h"
37 #include "content/public/browser/storage_partition.h" 38 #include "content/public/browser/storage_partition.h"
38 #include "net/url_request/url_request_context_getter.h" 39 #include "net/url_request/url_request_context_getter.h"
39 40
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 105
105 base::FilePath database_dir( 106 base::FilePath database_dir(
106 profile->GetPath().Append(ntp_snippets::kDatabaseFolder)); 107 profile->GetPath().Append(ntp_snippets::kDatabaseFolder));
107 scoped_refptr<base::SequencedTaskRunner> task_runner = 108 scoped_refptr<base::SequencedTaskRunner> task_runner =
108 BrowserThread::GetBlockingPool() 109 BrowserThread::GetBlockingPool()
109 ->GetSequencedTaskRunnerWithShutdownBehavior( 110 ->GetSequencedTaskRunnerWithShutdownBehavior(
110 base::SequencedWorkerPool::GetSequenceToken(), 111 base::SequencedWorkerPool::GetSequenceToken(),
111 base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN); 112 base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN);
112 113
113 return new ntp_snippets::NTPSnippetsService( 114 return new ntp_snippets::NTPSnippetsService(
114 enabled, profile->GetPrefs(), sync_service, suggestions_service, 115 enabled, profile->GetPrefs(), suggestions_service,
115 g_browser_process->GetApplicationLocale(), scheduler, 116 g_browser_process->GetApplicationLocale(), scheduler,
116 base::WrapUnique(new ntp_snippets::NTPSnippetsFetcher( 117 base::MakeUnique<ntp_snippets::NTPSnippetsFetcher>(
117 signin_manager, token_service, request_context, 118 signin_manager, token_service, request_context,
118 base::Bind(&safe_json::SafeJsonParser::Parse), 119 base::Bind(&safe_json::SafeJsonParser::Parse),
119 chrome::GetChannel() == version_info::Channel::STABLE)), 120 chrome::GetChannel() == version_info::Channel::STABLE),
120 base::WrapUnique(new ImageFetcherImpl(request_context.get())), 121 base::MakeUnique<ImageFetcherImpl>(request_context.get()),
121 base::WrapUnique(new ImageDecoderImpl()), 122 base::MakeUnique<ImageDecoderImpl>(),
122 base::WrapUnique( 123 base::MakeUnique<ntp_snippets::NTPSnippetsDatabase>(database_dir,
123 new ntp_snippets::NTPSnippetsDatabase(database_dir, task_runner))); 124 task_runner),
125 base::MakeUnique<ntp_snippets::NTPSnippetsStatusService>(signin_manager,
126 sync_service));
124 } 127 }
OLDNEW
« no previous file with comments | « chrome/browser/android/ntp/ntp_snippets_bridge.cc ('k') | chrome/browser/ui/webui/snippets_internals_message_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698