| 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/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 namespace content { | 35 namespace content { |
| 36 class BrowserContext; | 36 class BrowserContext; |
| 37 } | 37 } |
| 38 | 38 |
| 39 using data_reduction_proxy::DataReductionProxyParams; | 39 using data_reduction_proxy::DataReductionProxyParams; |
| 40 | 40 |
| 41 namespace { | 41 namespace { |
| 42 | 42 |
| 43 // For Android builds, notifies the TabAndroid associated with |web_contents| | 43 // For Android builds, notifies the TabAndroid associated with |web_contents| |
| 44 // that a Lo-Fi response has been received. The TabAndroid then handles showing | 44 // that a Lo-Fi response has been received. The TabAndroid then handles showing |
| 45 // Lo-Fi UI if this is the first Lo-Fi response for a page load. | 45 // Lo-Fi UI if this is the first Lo-Fi response for a page load. |is_preview| |
| 46 void OnLoFiResponseReceivedOnUI(content::WebContents* web_contents) { | 46 // indicates whether the response was a Lo-Fi preview response. |
| 47 void OnLoFiResponseReceivedOnUI(content::WebContents* web_contents, |
| 48 bool is_preview) { |
| 47 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 49 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 48 #if defined(OS_ANDROID) | 50 #if defined(OS_ANDROID) |
| 49 TabAndroid* tab = TabAndroid::FromWebContents(web_contents); | 51 TabAndroid* tab = TabAndroid::FromWebContents(web_contents); |
| 50 if (tab) | 52 if (tab) |
| 51 tab->OnLoFiResponseReceived(); | 53 tab->OnLoFiResponseReceived(is_preview); |
| 52 #endif | 54 #endif |
| 53 } | 55 } |
| 54 | 56 |
| 55 } // namespace | 57 } // namespace |
| 56 | 58 |
| 57 scoped_ptr<data_reduction_proxy::DataReductionProxyIOData> | 59 scoped_ptr<data_reduction_proxy::DataReductionProxyIOData> |
| 58 CreateDataReductionProxyChromeIOData( | 60 CreateDataReductionProxyChromeIOData( |
| 59 net::NetLog* net_log, | 61 net::NetLog* net_log, |
| 60 PrefService* prefs, | 62 PrefService* prefs, |
| 61 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner, | 63 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner, |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 base::Unretained( | 108 base::Unretained( |
| 107 data_reduction_proxy_io_data->configurator())), | 109 data_reduction_proxy_io_data->configurator())), |
| 108 ui_task_runner, io_task_runner, | 110 ui_task_runner, io_task_runner, |
| 109 g_browser_process->GetApplicationLocale())); | 111 g_browser_process->GetApplicationLocale())); |
| 110 data_reduction_proxy_io_data->set_debug_ui_service( | 112 data_reduction_proxy_io_data->set_debug_ui_service( |
| 111 std::move(data_reduction_proxy_ui_service)); | 113 std::move(data_reduction_proxy_ui_service)); |
| 112 #endif | 114 #endif |
| 113 | 115 |
| 114 return data_reduction_proxy_io_data; | 116 return data_reduction_proxy_io_data; |
| 115 } | 117 } |
| OLD | NEW |