| 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_delegate.h" | 5 #include "chrome/browser/previews/previews_infobar_delegate.h" |
| 6 | 6 |
| 7 #include "base/metrics/histogram_macros.h" | 7 #include "base/metrics/histogram_macros.h" |
| 8 #include "chrome/browser/android/android_theme_resources.h" | 8 #include "chrome/browser/android/android_theme_resources.h" |
| 9 #include "chrome/browser/infobars/infobar_service.h" | 9 #include "chrome/browser/infobars/infobar_service.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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 int PreviewsInfoBarDelegate::GetButtons() const { | 113 int PreviewsInfoBarDelegate::GetButtons() const { |
| 114 return BUTTON_NONE; | 114 return BUTTON_NONE; |
| 115 } | 115 } |
| 116 | 116 |
| 117 base::string16 PreviewsInfoBarDelegate::GetLinkText() const { | 117 base::string16 PreviewsInfoBarDelegate::GetLinkText() const { |
| 118 return l10n_util::GetStringUTF16(IDS_PREVIEWS_INFOBAR_LINK); | 118 return l10n_util::GetStringUTF16(IDS_PREVIEWS_INFOBAR_LINK); |
| 119 } | 119 } |
| 120 | 120 |
| 121 bool PreviewsInfoBarDelegate::LinkClicked(WindowOpenDisposition disposition) { | 121 bool PreviewsInfoBarDelegate::LinkClicked(WindowOpenDisposition disposition) { |
| 122 RecordPreviewsInfoBarAction(infobar_type_, INFOBAR_LOAD_ORIGINAL_CLICKED); | 122 RecordPreviewsInfoBarAction(infobar_type_, INFOBAR_LOAD_ORIGINAL_CLICKED); |
| 123 | 123 content::WebContents* web_contents = |
| 124 InfoBarService::WebContentsFromInfoBar(infobar()); |
| 124 if (infobar_type_ == LITE_PAGE || infobar_type_ == LOFI) { | 125 if (infobar_type_ == LITE_PAGE || infobar_type_ == LOFI) { |
| 125 auto* web_contents = | |
| 126 InfoBarService::WebContentsFromInfoBar(infobar()); | |
| 127 | |
| 128 if (infobar_type_ == LITE_PAGE) | 126 if (infobar_type_ == LITE_PAGE) |
| 129 web_contents->GetController().ReloadDisableLoFi(true); | 127 web_contents->GetController().ReloadDisableLoFi(true); |
| 130 else if (infobar_type_ == LOFI) | 128 else if (infobar_type_ == LOFI) |
| 131 web_contents->ReloadLoFiImages(); | 129 web_contents->ReloadLoFiImages(); |
| 132 | 130 |
| 133 auto* data_reduction_proxy_settings = | 131 auto* data_reduction_proxy_settings = |
| 134 DataReductionProxyChromeSettingsFactory::GetForBrowserContext( | 132 DataReductionProxyChromeSettingsFactory::GetForBrowserContext( |
| 135 web_contents->GetBrowserContext()); | 133 web_contents->GetBrowserContext()); |
| 136 data_reduction_proxy_settings->IncrementLoFiUserRequestsForImages(); | 134 data_reduction_proxy_settings->IncrementLoFiUserRequestsForImages(); |
| 135 } else if (infobar_type_ == OFFLINE) { |
| 136 web_contents->GetController().Reload(true); |
| 137 } | 137 } |
| 138 | 138 |
| 139 return true; | 139 return true; |
| 140 } | 140 } |
| OLD | NEW |