Check USB device path access when prompting users to select a device.
[chromium-blink-merge.git] / chrome / browser / net / spdyproxy / data_reduction_proxy_chrome_io_data.cc
blobe6e8ae215502ac73933be4bdef11d6fec6eed671
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
3 // found in the LICENSE file.
5 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_io_data.h"
7 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h"
8 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_io_data.h"
9 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_params.h"
11 #if defined(OS_ANDROID)
12 #include "base/android/build_info.h"
13 #endif
15 #if defined(ENABLE_DATA_REDUCTION_PROXY_DEBUGGING)
16 #include "chrome/browser/browser_process.h"
17 #include "components/data_reduction_proxy/content/browser/content_data_reduction_proxy_debug_ui_service.h"
18 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_configurator.h"
19 #endif
21 namespace content {
22 class BrowserContext;
25 using data_reduction_proxy::DataReductionProxyParams;
27 scoped_ptr<data_reduction_proxy::DataReductionProxyIOData>
28 CreateDataReductionProxyChromeIOData(
29 net::NetLog* net_log,
30 PrefService* prefs,
31 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner,
32 const scoped_refptr<base::SingleThreadTaskRunner>& ui_task_runner,
33 bool enable_quic) {
34 DCHECK(net_log);
35 DCHECK(prefs);
37 int flags = DataReductionProxyParams::kAllowed |
38 DataReductionProxyParams::kFallbackAllowed |
39 DataReductionProxyParams::kAlternativeAllowed;
40 if (DataReductionProxyParams::IsIncludedInPromoFieldTrial())
41 flags |= DataReductionProxyParams::kPromoAllowed;
42 if (DataReductionProxyParams::IsIncludedInHoldbackFieldTrial())
43 flags |= DataReductionProxyParams::kHoldback;
44 #if defined(OS_ANDROID)
45 if (DataReductionProxyParams::IsIncludedInAndroidOnePromoFieldTrial(
46 base::android::BuildInfo::GetInstance()->android_build_fp())) {
47 flags |= DataReductionProxyParams::kPromoAllowed;
49 #endif
51 scoped_ptr<data_reduction_proxy::DataReductionProxyIOData>
52 data_reduction_proxy_io_data(
53 new data_reduction_proxy::DataReductionProxyIOData(
54 DataReductionProxyChromeSettings::GetClient(), flags, net_log,
55 io_task_runner, ui_task_runner, enable_quic));
56 data_reduction_proxy_io_data->InitOnUIThread(prefs);
58 #if defined(ENABLE_DATA_REDUCTION_PROXY_DEBUGGING)
59 scoped_ptr<data_reduction_proxy::ContentDataReductionProxyDebugUIService>
60 data_reduction_proxy_ui_service(
61 new data_reduction_proxy::ContentDataReductionProxyDebugUIService(
62 base::Bind(&data_reduction_proxy::DataReductionProxyConfigurator::
63 GetProxyConfigOnIOThread,
64 base::Unretained(
65 data_reduction_proxy_io_data->configurator())),
66 ui_task_runner, io_task_runner,
67 g_browser_process->GetApplicationLocale()));
68 data_reduction_proxy_io_data->set_debug_ui_service(
69 data_reduction_proxy_ui_service.Pass());
70 #endif
72 return data_reduction_proxy_io_data.Pass();