| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/previews/previews_infobar_tab_helper.h" | 5 #include "chrome/browser/previews/previews_infobar_tab_helper.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "chrome/browser/loader/chrome_navigation_data.h" | 9 #include "chrome/browser/loader/chrome_navigation_data.h" |
| 10 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h" | 10 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h" |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 } | 103 } |
| 104 data_reduction_proxy::DataReductionProxySettings* | 104 data_reduction_proxy::DataReductionProxySettings* |
| 105 data_reduction_proxy_settings = | 105 data_reduction_proxy_settings = |
| 106 DataReductionProxyChromeSettingsFactory::GetForBrowserContext( | 106 DataReductionProxyChromeSettingsFactory::GetForBrowserContext( |
| 107 web_contents()->GetBrowserContext()); | 107 web_contents()->GetBrowserContext()); |
| 108 PreviewsInfoBarDelegate::Create( | 108 PreviewsInfoBarDelegate::Create( |
| 109 web_contents(), PreviewsInfoBarDelegate::OFFLINE, | 109 web_contents(), PreviewsInfoBarDelegate::OFFLINE, |
| 110 data_reduction_proxy_settings && | 110 data_reduction_proxy_settings && |
| 111 data_reduction_proxy_settings->IsDataReductionProxyEnabled(), | 111 data_reduction_proxy_settings->IsDataReductionProxyEnabled(), |
| 112 base::Bind(&AddPreviewNavigationCallback, browser_context_, | 112 base::Bind(&AddPreviewNavigationCallback, browser_context_, |
| 113 navigation_handle->GetURL(), | 113 navigation_handle->GetRedirectChain()[0], |
| 114 previews::PreviewsType::OFFLINE)); | 114 previews::PreviewsType::OFFLINE)); |
| 115 // Don't try to show other infobars if this is an offline preview. | 115 // Don't try to show other infobars if this is an offline preview. |
| 116 return; | 116 return; |
| 117 } | 117 } |
| 118 #endif // defined(OS_ANDROID) | 118 #endif // defined(OS_ANDROID) |
| 119 | 119 |
| 120 const net::HttpResponseHeaders* headers = | 120 const net::HttpResponseHeaders* headers = |
| 121 navigation_handle->GetResponseHeaders(); | 121 navigation_handle->GetResponseHeaders(); |
| 122 if (headers && data_reduction_proxy::IsLitePagePreview(*headers)) { | 122 if (headers && data_reduction_proxy::IsLitePagePreview(*headers)) { |
| 123 PreviewsInfoBarDelegate::Create( | 123 PreviewsInfoBarDelegate::Create( |
| (...skipping 10 matching lines...) Expand all Loading... |
| 134 DataReductionProxyChromeSettingsFactory::GetForBrowserContext( | 134 DataReductionProxyChromeSettingsFactory::GetForBrowserContext( |
| 135 browser_context_); | 135 browser_context_); |
| 136 if (!data_reduction_proxy_settings || | 136 if (!data_reduction_proxy_settings || |
| 137 !data_reduction_proxy_settings->data_reduction_proxy_service()) { | 137 !data_reduction_proxy_settings->data_reduction_proxy_service()) { |
| 138 return; | 138 return; |
| 139 } | 139 } |
| 140 data_reduction_proxy_settings->data_reduction_proxy_service() | 140 data_reduction_proxy_settings->data_reduction_proxy_service() |
| 141 ->pingback_client() | 141 ->pingback_client() |
| 142 ->ClearNavigationKeyAsync(committed_data_saver_navigation_id_.value()); | 142 ->ClearNavigationKeyAsync(committed_data_saver_navigation_id_.value()); |
| 143 } | 143 } |
| OLD | NEW |