| OLD | NEW |
| 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 24 matching lines...) Expand all Loading... |
| 35 using data_reduction_proxy::DataReductionProxyParams; | 35 using data_reduction_proxy::DataReductionProxyParams; |
| 36 | 36 |
| 37 namespace { | 37 namespace { |
| 38 | 38 |
| 39 // If this is the first Lo-Fi response for a page load, a | 39 // If this is the first Lo-Fi response for a page load, a |
| 40 // PreviewsInfoBarDelegate is created, which handles showing Lo-Fi UI. | 40 // PreviewsInfoBarDelegate is created, which handles showing Lo-Fi UI. |
| 41 void OnLoFiResponseReceivedOnUI(content::WebContents* web_contents) { | 41 void OnLoFiResponseReceivedOnUI(content::WebContents* web_contents) { |
| 42 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 42 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 43 PreviewsInfoBarDelegate::Create( | 43 PreviewsInfoBarDelegate::Create( |
| 44 web_contents, PreviewsInfoBarDelegate::LOFI, | 44 web_contents, PreviewsInfoBarDelegate::LOFI, |
| 45 true /* is_data_saver_user */, |
| 45 PreviewsInfoBarDelegate::OnDismissPreviewsInfobarCallback()); | 46 PreviewsInfoBarDelegate::OnDismissPreviewsInfobarCallback()); |
| 46 } | 47 } |
| 47 | 48 |
| 48 } // namespace | 49 } // namespace |
| 49 | 50 |
| 50 std::unique_ptr<data_reduction_proxy::DataReductionProxyIOData> | 51 std::unique_ptr<data_reduction_proxy::DataReductionProxyIOData> |
| 51 CreateDataReductionProxyChromeIOData( | 52 CreateDataReductionProxyChromeIOData( |
| 52 net::NetLog* net_log, | 53 net::NetLog* net_log, |
| 53 PrefService* prefs, | 54 PrefService* prefs, |
| 54 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner, | 55 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner, |
| (...skipping 27 matching lines...) Expand all Loading... |
| 82 data_reduction_proxy_io_data->set_lofi_decider( | 83 data_reduction_proxy_io_data->set_lofi_decider( |
| 83 base::MakeUnique<data_reduction_proxy::ContentLoFiDecider>()); | 84 base::MakeUnique<data_reduction_proxy::ContentLoFiDecider>()); |
| 84 data_reduction_proxy_io_data->set_lofi_ui_service( | 85 data_reduction_proxy_io_data->set_lofi_ui_service( |
| 85 base::MakeUnique<data_reduction_proxy::ContentLoFiUIService>( | 86 base::MakeUnique<data_reduction_proxy::ContentLoFiUIService>( |
| 86 ui_task_runner, base::Bind(&OnLoFiResponseReceivedOnUI))); | 87 ui_task_runner, base::Bind(&OnLoFiResponseReceivedOnUI))); |
| 87 data_reduction_proxy_io_data->set_data_usage_source_provider( | 88 data_reduction_proxy_io_data->set_data_usage_source_provider( |
| 88 base::MakeUnique<ChromeDataUseGroupProvider>()); | 89 base::MakeUnique<ChromeDataUseGroupProvider>()); |
| 89 | 90 |
| 90 return data_reduction_proxy_io_data; | 91 return data_reduction_proxy_io_data; |
| 91 } | 92 } |
| OLD | NEW |