| 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 22 matching lines...) Expand all Loading... |
| 33 } | 33 } |
| 34 | 34 |
| 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(web_contents, PreviewsInfoBarDelegate::LOFI); | 43 PreviewsInfoBarDelegate::Create( |
| 44 web_contents, PreviewsInfoBarDelegate::LOFI, |
| 45 PreviewsInfoBarDelegate::OnDismissPreviewsInfobarCallback()); |
| 44 } | 46 } |
| 45 | 47 |
| 46 } // namespace | 48 } // namespace |
| 47 | 49 |
| 48 std::unique_ptr<data_reduction_proxy::DataReductionProxyIOData> | 50 std::unique_ptr<data_reduction_proxy::DataReductionProxyIOData> |
| 49 CreateDataReductionProxyChromeIOData( | 51 CreateDataReductionProxyChromeIOData( |
| 50 net::NetLog* net_log, | 52 net::NetLog* net_log, |
| 51 PrefService* prefs, | 53 PrefService* prefs, |
| 52 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner, | 54 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner, |
| 53 const scoped_refptr<base::SingleThreadTaskRunner>& ui_task_runner) { | 55 const scoped_refptr<base::SingleThreadTaskRunner>& ui_task_runner) { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 80 data_reduction_proxy_io_data->set_lofi_decider( | 82 data_reduction_proxy_io_data->set_lofi_decider( |
| 81 base::MakeUnique<data_reduction_proxy::ContentLoFiDecider>()); | 83 base::MakeUnique<data_reduction_proxy::ContentLoFiDecider>()); |
| 82 data_reduction_proxy_io_data->set_lofi_ui_service( | 84 data_reduction_proxy_io_data->set_lofi_ui_service( |
| 83 base::MakeUnique<data_reduction_proxy::ContentLoFiUIService>( | 85 base::MakeUnique<data_reduction_proxy::ContentLoFiUIService>( |
| 84 ui_task_runner, base::Bind(&OnLoFiResponseReceivedOnUI))); | 86 ui_task_runner, base::Bind(&OnLoFiResponseReceivedOnUI))); |
| 85 data_reduction_proxy_io_data->set_data_usage_source_provider( | 87 data_reduction_proxy_io_data->set_data_usage_source_provider( |
| 86 base::MakeUnique<ChromeDataUseGroupProvider>()); | 88 base::MakeUnique<ChromeDataUseGroupProvider>()); |
| 87 | 89 |
| 88 return data_reduction_proxy_io_data; | 90 return data_reduction_proxy_io_data; |
| 89 } | 91 } |
| OLD | NEW |