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

Side by Side Diff: chrome/browser/profiles/profile_impl_io_data.cc

Issue 2300213002: Adding an IO Data and keyed service to previews/ (Closed)
Patch Set: change to unittest Created 4 years, 3 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/profiles/profile_impl_io_data.h" 5 #include "chrome/browser/profiles/profile_impl_io_data.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
11 11
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/command_line.h" 13 #include "base/command_line.h"
14 #include "base/logging.h" 14 #include "base/logging.h"
15 #include "base/macros.h" 15 #include "base/macros.h"
16 #include "base/memory/ptr_util.h"
16 #include "base/metrics/field_trial.h" 17 #include "base/metrics/field_trial.h"
17 #include "base/sequenced_task_runner.h" 18 #include "base/sequenced_task_runner.h"
18 #include "base/stl_util.h" 19 #include "base/stl_util.h"
19 #include "base/strings/string_util.h" 20 #include "base/strings/string_util.h"
20 #include "base/threading/sequenced_worker_pool.h" 21 #include "base/threading/sequenced_worker_pool.h"
21 #include "base/threading/worker_pool.h" 22 #include "base/threading/worker_pool.h"
22 #include "build/build_config.h" 23 #include "build/build_config.h"
23 #include "chrome/browser/browser_process.h" 24 #include "chrome/browser/browser_process.h"
24 #include "chrome/browser/chrome_notification_types.h" 25 #include "chrome/browser/chrome_notification_types.h"
25 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" 26 #include "chrome/browser/custom_handlers/protocol_handler_registry.h"
26 #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h" 27 #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h"
27 #include "chrome/browser/io_thread.h" 28 #include "chrome/browser/io_thread.h"
28 #include "chrome/browser/net/chrome_network_delegate.h" 29 #include "chrome/browser/net/chrome_network_delegate.h"
29 #include "chrome/browser/net/http_server_properties_manager_factory.h" 30 #include "chrome/browser/net/http_server_properties_manager_factory.h"
30 #include "chrome/browser/net/predictor.h" 31 #include "chrome/browser/net/predictor.h"
31 #include "chrome/browser/net/quota_policy_channel_id_store.h" 32 #include "chrome/browser/net/quota_policy_channel_id_store.h"
32 #include "chrome/browser/net/sdch_owner_pref_storage.h" 33 #include "chrome/browser/net/sdch_owner_pref_storage.h"
33 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_io_data.h" 34 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_io_data.h"
34 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h" 35 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h"
35 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_fact ory.h" 36 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_fact ory.h"
37 #include "chrome/browser/previews/previews_service.h"
38 #include "chrome/browser/previews/previews_service_factory.h"
36 #include "chrome/browser/profiles/profile.h" 39 #include "chrome/browser/profiles/profile.h"
37 #include "chrome/common/chrome_constants.h" 40 #include "chrome/common/chrome_constants.h"
38 #include "chrome/common/chrome_switches.h" 41 #include "chrome/common/chrome_switches.h"
39 #include "chrome/common/pref_names.h" 42 #include "chrome/common/pref_names.h"
40 #include "chrome/common/url_constants.h" 43 #include "chrome/common/url_constants.h"
41 #include "components/cookie_config/cookie_store_util.h" 44 #include "components/cookie_config/cookie_store_util.h"
42 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_io_d ata.h" 45 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_io_d ata.h"
43 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_sett ings.h" 46 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_sett ings.h"
44 #include "components/data_reduction_proxy/core/browser/data_store_impl.h" 47 #include "components/data_reduction_proxy/core/browser/data_store_impl.h"
45 #include "components/domain_reliability/monitor.h" 48 #include "components/domain_reliability/monitor.h"
46 #include "components/net_log/chrome_net_log.h" 49 #include "components/net_log/chrome_net_log.h"
47 #include "components/prefs/json_pref_store.h" 50 #include "components/prefs/json_pref_store.h"
48 #include "components/prefs/pref_filter.h" 51 #include "components/prefs/pref_filter.h"
49 #include "components/prefs/pref_member.h" 52 #include "components/prefs/pref_member.h"
50 #include "components/prefs/pref_service.h" 53 #include "components/prefs/pref_service.h"
54 #include "components/previews/previews_io_data.h"
55 #include "components/previews/previews_ui_service.h"
51 #include "content/public/browser/browser_thread.h" 56 #include "content/public/browser/browser_thread.h"
52 #include "content/public/browser/cookie_store_factory.h" 57 #include "content/public/browser/cookie_store_factory.h"
53 #include "content/public/browser/notification_service.h" 58 #include "content/public/browser/notification_service.h"
54 #include "content/public/browser/resource_context.h" 59 #include "content/public/browser/resource_context.h"
55 #include "content/public/browser/storage_partition.h" 60 #include "content/public/browser/storage_partition.h"
56 #include "extensions/browser/extension_protocols.h" 61 #include "extensions/browser/extension_protocols.h"
57 #include "extensions/common/constants.h" 62 #include "extensions/common/constants.h"
58 #include "net/base/cache_type.h" 63 #include "net/base/cache_type.h"
59 #include "net/base/sdch_manager.h" 64 #include "net/base/sdch_manager.h"
60 #include "net/cookies/cookie_store.h" 65 #include "net/cookies/cookie_store.h"
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 pool->GetSequenceToken(), 198 pool->GetSequenceToken(),
194 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN); 199 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN);
195 std::unique_ptr<data_reduction_proxy::DataStore> store( 200 std::unique_ptr<data_reduction_proxy::DataStore> store(
196 new data_reduction_proxy::DataStoreImpl(profile_path)); 201 new data_reduction_proxy::DataStoreImpl(profile_path));
197 DataReductionProxyChromeSettingsFactory::GetForBrowserContext(profile_) 202 DataReductionProxyChromeSettingsFactory::GetForBrowserContext(profile_)
198 ->InitDataReductionProxySettings( 203 ->InitDataReductionProxySettings(
199 io_data_->data_reduction_proxy_io_data(), profile_->GetPrefs(), 204 io_data_->data_reduction_proxy_io_data(), profile_->GetPrefs(),
200 profile_->GetRequestContext(), std::move(store), 205 profile_->GetRequestContext(), std::move(store),
201 BrowserThread::GetTaskRunnerForThread(BrowserThread::UI), 206 BrowserThread::GetTaskRunnerForThread(BrowserThread::UI),
202 db_task_runner); 207 db_task_runner);
208
209 io_data_->set_previews_io_data(base::WrapUnique(new previews::PreviewsIOData(
210 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO),
211 BrowserThread::GetTaskRunnerForThread(BrowserThread::UI))));
212 PreviewsServiceFactory::GetForProfile(profile_)->set_previews_ui_service(
213 base::WrapUnique(new previews::PreviewsUIService(
214 io_data_->previews_io_data(),
215 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO))));
203 } 216 }
204 217
205 content::ResourceContext* 218 content::ResourceContext*
206 ProfileImplIOData::Handle::GetResourceContext() const { 219 ProfileImplIOData::Handle::GetResourceContext() const {
207 DCHECK_CURRENTLY_ON(BrowserThread::UI); 220 DCHECK_CURRENTLY_ON(BrowserThread::UI);
208 LazyInitialize(); 221 LazyInitialize();
209 return GetResourceContextNoInit(); 222 return GetResourceContextNoInit();
210 } 223 }
211 224
212 content::ResourceContext* 225 content::ResourceContext*
(...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after
792 const base::Closure& completion) { 805 const base::Closure& completion) {
793 DCHECK_CURRENTLY_ON(BrowserThread::IO); 806 DCHECK_CURRENTLY_ON(BrowserThread::IO);
794 DCHECK(initialized()); 807 DCHECK(initialized());
795 808
796 DCHECK(transport_security_state()); 809 DCHECK(transport_security_state());
797 // Completes synchronously. 810 // Completes synchronously.
798 transport_security_state()->DeleteAllDynamicDataSince(time); 811 transport_security_state()->DeleteAllDynamicDataSince(time);
799 DCHECK(http_server_properties_manager_); 812 DCHECK(http_server_properties_manager_);
800 http_server_properties_manager_->Clear(completion); 813 http_server_properties_manager_->Clear(completion);
801 } 814 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698