| 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 int PreviewsInfoBarDelegate::GetIconId() const { | 102 int PreviewsInfoBarDelegate::GetIconId() const { |
| 103 #if defined(OS_ANDROID) | 103 #if defined(OS_ANDROID) |
| 104 return IDR_ANDROID_INFOBAR_PREVIEWS; | 104 return IDR_ANDROID_INFOBAR_PREVIEWS; |
| 105 #else | 105 #else |
| 106 return kNoIconID; | 106 return kNoIconID; |
| 107 #endif | 107 #endif |
| 108 } | 108 } |
| 109 | 109 |
| 110 bool PreviewsInfoBarDelegate::ShouldExpire( | 110 bool PreviewsInfoBarDelegate::ShouldExpire( |
| 111 const NavigationDetails& details) const { | 111 const NavigationDetails& details) const { |
| 112 RecordPreviewsInfoBarAction(infobar_type_, INFOBAR_DISMISSED_BY_NAVIGATION); | 112 RecordPreviewsInfoBarAction( |
| 113 infobar_type_, details.is_reload ? INFOBAR_DISMISSED_BY_RELOAD |
| 114 : INFOBAR_DISMISSED_BY_NAVIGATION); |
| 113 return InfoBarDelegate::ShouldExpire(details); | 115 return InfoBarDelegate::ShouldExpire(details); |
| 114 } | 116 } |
| 115 | 117 |
| 116 void PreviewsInfoBarDelegate::InfoBarDismissed() { | 118 void PreviewsInfoBarDelegate::InfoBarDismissed() { |
| 117 RecordPreviewsInfoBarAction(infobar_type_, INFOBAR_DISMISSED_BY_USER); | 119 RecordPreviewsInfoBarAction(infobar_type_, INFOBAR_DISMISSED_BY_USER); |
| 118 } | 120 } |
| 119 | 121 |
| 120 base::string16 PreviewsInfoBarDelegate::GetMessageText() const { | 122 base::string16 PreviewsInfoBarDelegate::GetMessageText() const { |
| 121 return message_text_; | 123 return message_text_; |
| 122 } | 124 } |
| (...skipping 24 matching lines...) Expand all Loading... |
| 147 auto* data_reduction_proxy_settings = | 149 auto* data_reduction_proxy_settings = |
| 148 DataReductionProxyChromeSettingsFactory::GetForBrowserContext( | 150 DataReductionProxyChromeSettingsFactory::GetForBrowserContext( |
| 149 web_contents->GetBrowserContext()); | 151 web_contents->GetBrowserContext()); |
| 150 data_reduction_proxy_settings->IncrementLoFiUserRequestsForImages(); | 152 data_reduction_proxy_settings->IncrementLoFiUserRequestsForImages(); |
| 151 } else if (infobar_type_ == OFFLINE) { | 153 } else if (infobar_type_ == OFFLINE) { |
| 152 web_contents->GetController().Reload(content::ReloadType::NORMAL, true); | 154 web_contents->GetController().Reload(content::ReloadType::NORMAL, true); |
| 153 } | 155 } |
| 154 | 156 |
| 155 return true; | 157 return true; |
| 156 } | 158 } |
| OLD | NEW |