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

Side by Side Diff: chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_io_data.cc

Issue 2922663002: Data Reduction Proxy: Remove duplicate functions (Closed)
Patch Set: megjablon comments Created 3 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/net/spdyproxy/data_reduction_proxy_settings_android.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/net/spdyproxy/data_reduction_proxy_chrome_io_data.h" 5 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_io_data.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 15 matching lines...) Expand all
26 #include "components/previews/core/previews_experiments.h" 26 #include "components/previews/core/previews_experiments.h"
27 #include "components/previews/core/previews_ui_service.h" 27 #include "components/previews/core/previews_ui_service.h"
28 #include "components/version_info/version_info.h" 28 #include "components/version_info/version_info.h"
29 #include "content/public/browser/browser_context.h" 29 #include "content/public/browser/browser_context.h"
30 #include "content/public/browser/browser_thread.h" 30 #include "content/public/browser/browser_thread.h"
31 #include "content/public/browser/navigation_controller.h" 31 #include "content/public/browser/navigation_controller.h"
32 #include "content/public/browser/navigation_entry.h" 32 #include "content/public/browser/navigation_entry.h"
33 #include "content/public/browser/web_contents.h" 33 #include "content/public/browser/web_contents.h"
34 #include "url/gurl.h" 34 #include "url/gurl.h"
35 35
36 #if defined(OS_ANDROID)
37 #include "base/android/build_info.h"
38 #endif
39
40 namespace content { 36 namespace content {
41 class BrowserContext; 37 class BrowserContext;
42 } 38 }
43 39
44 using data_reduction_proxy::DataReductionProxyParams; 40 using data_reduction_proxy::DataReductionProxyParams;
45 41
46 namespace { 42 namespace {
47 43
48 // Adds the preview navigation to the black list. 44 // Adds the preview navigation to the black list.
49 void AddPreviewNavigationToBlackListCallback( 45 void AddPreviewNavigationToBlackListCallback(
(...skipping 27 matching lines...) Expand all
77 73
78 std::unique_ptr<data_reduction_proxy::DataReductionProxyIOData> 74 std::unique_ptr<data_reduction_proxy::DataReductionProxyIOData>
79 CreateDataReductionProxyChromeIOData( 75 CreateDataReductionProxyChromeIOData(
80 net::NetLog* net_log, 76 net::NetLog* net_log,
81 PrefService* prefs, 77 PrefService* prefs,
82 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner, 78 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner,
83 const scoped_refptr<base::SingleThreadTaskRunner>& ui_task_runner) { 79 const scoped_refptr<base::SingleThreadTaskRunner>& ui_task_runner) {
84 DCHECK(net_log); 80 DCHECK(net_log);
85 DCHECK(prefs); 81 DCHECK(prefs);
86 82
87 int flags = 0;
88 if (data_reduction_proxy::params::IsIncludedInPromoFieldTrial())
89 flags |= DataReductionProxyParams::kPromoAllowed;
90 if (data_reduction_proxy::params::IsIncludedInHoldbackFieldTrial())
91 flags |= DataReductionProxyParams::kHoldback;
92 #if defined(OS_ANDROID)
93 if (data_reduction_proxy::params::IsIncludedInAndroidOnePromoFieldTrial(
94 base::android::BuildInfo::GetInstance()->android_build_fp())) {
95 flags |= DataReductionProxyParams::kPromoAllowed;
96 }
97 #endif
98
99 bool enabled = 83 bool enabled =
100 prefs->GetBoolean(prefs::kDataSaverEnabled) || 84 prefs->GetBoolean(prefs::kDataSaverEnabled) ||
101 data_reduction_proxy::params::ShouldForceEnableDataReductionProxy(); 85 data_reduction_proxy::params::ShouldForceEnableDataReductionProxy();
102 std::unique_ptr<data_reduction_proxy::DataReductionProxyIOData> 86 std::unique_ptr<data_reduction_proxy::DataReductionProxyIOData>
103 data_reduction_proxy_io_data( 87 data_reduction_proxy_io_data(
104 new data_reduction_proxy::DataReductionProxyIOData( 88 new data_reduction_proxy::DataReductionProxyIOData(
105 DataReductionProxyChromeSettings::GetClient(), flags, net_log, 89 DataReductionProxyChromeSettings::GetClient(), net_log,
106 io_task_runner, ui_task_runner, enabled, GetUserAgent(), 90 io_task_runner, ui_task_runner, enabled, GetUserAgent(),
107 version_info::GetChannelString(chrome::GetChannel()))); 91 version_info::GetChannelString(chrome::GetChannel())));
108 92
109 data_reduction_proxy_io_data->set_lofi_decider( 93 data_reduction_proxy_io_data->set_lofi_decider(
110 base::MakeUnique<data_reduction_proxy::ContentLoFiDecider>()); 94 base::MakeUnique<data_reduction_proxy::ContentLoFiDecider>());
111 data_reduction_proxy_io_data->set_resource_type_provider( 95 data_reduction_proxy_io_data->set_resource_type_provider(
112 base::MakeUnique<data_reduction_proxy::ContentResourceTypeProvider>()); 96 base::MakeUnique<data_reduction_proxy::ContentResourceTypeProvider>());
113 data_reduction_proxy_io_data->set_lofi_ui_service( 97 data_reduction_proxy_io_data->set_lofi_ui_service(
114 base::MakeUnique<data_reduction_proxy::ContentLoFiUIService>( 98 base::MakeUnique<data_reduction_proxy::ContentLoFiUIService>(
115 ui_task_runner, base::Bind(&OnLoFiResponseReceivedOnUI))); 99 ui_task_runner, base::Bind(&OnLoFiResponseReceivedOnUI)));
116 100
117 return data_reduction_proxy_io_data; 101 return data_reduction_proxy_io_data;
118 } 102 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/net/spdyproxy/data_reduction_proxy_settings_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698