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

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

Issue 2047713002: [NTP Snippets] Cache images in a LevelDB (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@protodb_get
Patch Set: add TODOs Created 4 years, 6 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 | chrome/browser/search/suggestions/image_fetcher_impl.cc » ('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 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_fetcher_impl.h" 14 #include "chrome/browser/search/suggestions/image_fetcher_impl.h"
14 #include "chrome/browser/search/suggestions/suggestions_service_factory.h" 15 #include "chrome/browser/search/suggestions/suggestions_service_factory.h"
15 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" 16 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
16 #include "chrome/browser/signin/signin_manager_factory.h" 17 #include "chrome/browser/signin/signin_manager_factory.h"
17 #include "chrome/browser/sync/profile_sync_service_factory.h" 18 #include "chrome/browser/sync/profile_sync_service_factory.h"
18 #include "chrome/common/channel_info.h" 19 #include "chrome/common/channel_info.h"
19 #include "chrome/common/pref_names.h" 20 #include "chrome/common/pref_names.h"
20 #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"
21 #include "components/image_fetcher/image_fetcher.h" 23 #include "components/image_fetcher/image_fetcher.h"
22 #include "components/keyed_service/content/browser_context_dependency_manager.h" 24 #include "components/keyed_service/content/browser_context_dependency_manager.h"
23 #include "components/ntp_snippets/ntp_snippets_constants.h" 25 #include "components/ntp_snippets/ntp_snippets_constants.h"
24 #include "components/ntp_snippets/ntp_snippets_database.h" 26 #include "components/ntp_snippets/ntp_snippets_database.h"
25 #include "components/ntp_snippets/ntp_snippets_fetcher.h" 27 #include "components/ntp_snippets/ntp_snippets_fetcher.h"
26 #include "components/ntp_snippets/ntp_snippets_scheduler.h" 28 #include "components/ntp_snippets/ntp_snippets_scheduler.h"
27 #include "components/ntp_snippets/ntp_snippets_service.h" 29 #include "components/ntp_snippets/ntp_snippets_service.h"
28 #include "components/prefs/pref_service.h" 30 #include "components/prefs/pref_service.h"
29 #include "components/safe_json/safe_json_parser.h" 31 #include "components/safe_json/safe_json_parser.h"
30 #include "components/signin/core/browser/profile_oauth2_token_service.h" 32 #include "components/signin/core/browser/profile_oauth2_token_service.h"
31 #include "components/signin/core/browser/signin_manager.h" 33 #include "components/signin/core/browser/signin_manager.h"
32 #include "components/version_info/version_info.h" 34 #include "components/version_info/version_info.h"
33 #include "content/public/browser/browser_context.h" 35 #include "content/public/browser/browser_context.h"
34 #include "content/public/browser/browser_thread.h" 36 #include "content/public/browser/browser_thread.h"
35 #include "content/public/browser/storage_partition.h" 37 #include "content/public/browser/storage_partition.h"
36 #include "net/url_request/url_request_context_getter.h" 38 #include "net/url_request/url_request_context_getter.h"
37 39
38 #if defined(OS_ANDROID) 40 #if defined(OS_ANDROID)
39 #include "chrome/browser/android/chrome_feature_list.h" 41 #include "chrome/browser/android/chrome_feature_list.h"
40 #include "chrome/browser/android/ntp/ntp_snippets_launcher.h" 42 #include "chrome/browser/android/ntp/ntp_snippets_launcher.h"
41 #endif // OS_ANDROID 43 #endif // OS_ANDROID
42 44
43 using content::BrowserThread; 45 using content::BrowserThread;
46 using suggestions::ImageDecoderImpl;
44 using suggestions::ImageFetcherImpl; 47 using suggestions::ImageFetcherImpl;
45 using suggestions::SuggestionsService; 48 using suggestions::SuggestionsService;
46 using suggestions::SuggestionsServiceFactory; 49 using suggestions::SuggestionsServiceFactory;
47 50
48 // static 51 // static
49 NTPSnippetsServiceFactory* NTPSnippetsServiceFactory::GetInstance() { 52 NTPSnippetsServiceFactory* NTPSnippetsServiceFactory::GetInstance() {
50 return base::Singleton<NTPSnippetsServiceFactory>::get(); 53 return base::Singleton<NTPSnippetsServiceFactory>::get();
51 } 54 }
52 55
53 // static 56 // static
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN); 111 base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN);
109 112
110 return new ntp_snippets::NTPSnippetsService( 113 return new ntp_snippets::NTPSnippetsService(
111 enabled, profile->GetPrefs(), sync_service, suggestions_service, 114 enabled, profile->GetPrefs(), sync_service, suggestions_service,
112 g_browser_process->GetApplicationLocale(), scheduler, 115 g_browser_process->GetApplicationLocale(), scheduler,
113 base::WrapUnique(new ntp_snippets::NTPSnippetsFetcher( 116 base::WrapUnique(new ntp_snippets::NTPSnippetsFetcher(
114 signin_manager, token_service, request_context, 117 signin_manager, token_service, request_context,
115 base::Bind(&safe_json::SafeJsonParser::Parse), 118 base::Bind(&safe_json::SafeJsonParser::Parse),
116 chrome::GetChannel() == version_info::Channel::STABLE)), 119 chrome::GetChannel() == version_info::Channel::STABLE)),
117 base::WrapUnique(new ImageFetcherImpl(request_context.get())), 120 base::WrapUnique(new ImageFetcherImpl(request_context.get())),
121 base::WrapUnique(new ImageDecoderImpl()),
118 base::WrapUnique( 122 base::WrapUnique(
119 new ntp_snippets::NTPSnippetsDatabase(database_dir, task_runner))); 123 new ntp_snippets::NTPSnippetsDatabase(database_dir, task_runner)));
120 } 124 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/search/suggestions/image_fetcher_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698