Chromium Code Reviews| 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 96 int PreviewsInfoBarDelegate::GetIconId() const { | 96 int PreviewsInfoBarDelegate::GetIconId() const { |
| 97 #if defined(OS_ANDROID) | 97 #if defined(OS_ANDROID) |
| 98 return IDR_ANDROID_INFOBAR_PREVIEWS; | 98 return IDR_ANDROID_INFOBAR_PREVIEWS; |
| 99 #else | 99 #else |
| 100 return kNoIconID; | 100 return kNoIconID; |
| 101 #endif | 101 #endif |
| 102 } | 102 } |
| 103 | 103 |
| 104 bool PreviewsInfoBarDelegate::ShouldExpire( | 104 bool PreviewsInfoBarDelegate::ShouldExpire( |
| 105 const NavigationDetails& details) const { | 105 const NavigationDetails& details) const { |
| 106 RecordPreviewsInfoBarAction(infobar_type_, INFOBAR_DISMISSED_BY_NAVIGATION); | 106 RecordPreviewsInfoBarAction( |
|
RyanSturm
2016/12/09 17:04:42
Add unit test coverage.
RyanSturm
2016/12/17 00:21:54
Done.
| |
| 107 infobar_type_, details.is_reload ? INFOBAR_DISMISSED_BY_RELOAD | |
| 108 : INFOBAR_DISMISSED_BY_NAVIGATION); | |
| 107 return InfoBarDelegate::ShouldExpire(details); | 109 return InfoBarDelegate::ShouldExpire(details); |
| 108 } | 110 } |
| 109 | 111 |
| 110 void PreviewsInfoBarDelegate::InfoBarDismissed() { | 112 void PreviewsInfoBarDelegate::InfoBarDismissed() { |
| 111 RecordPreviewsInfoBarAction(infobar_type_, INFOBAR_DISMISSED_BY_USER); | 113 RecordPreviewsInfoBarAction(infobar_type_, INFOBAR_DISMISSED_BY_USER); |
| 112 } | 114 } |
| 113 | 115 |
| 114 base::string16 PreviewsInfoBarDelegate::GetMessageText() const { | 116 base::string16 PreviewsInfoBarDelegate::GetMessageText() const { |
| 115 return l10n_util::GetStringUTF16((infobar_type_ == OFFLINE) | 117 return l10n_util::GetStringUTF16((infobar_type_ == OFFLINE) |
| 116 ? IDS_PREVIEWS_INFOBAR_FASTER_PAGE_TITLE | 118 ? IDS_PREVIEWS_INFOBAR_FASTER_PAGE_TITLE |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 142 auto* data_reduction_proxy_settings = | 144 auto* data_reduction_proxy_settings = |
| 143 DataReductionProxyChromeSettingsFactory::GetForBrowserContext( | 145 DataReductionProxyChromeSettingsFactory::GetForBrowserContext( |
| 144 web_contents->GetBrowserContext()); | 146 web_contents->GetBrowserContext()); |
| 145 data_reduction_proxy_settings->IncrementLoFiUserRequestsForImages(); | 147 data_reduction_proxy_settings->IncrementLoFiUserRequestsForImages(); |
| 146 } else if (infobar_type_ == OFFLINE) { | 148 } else if (infobar_type_ == OFFLINE) { |
| 147 web_contents->GetController().Reload(true); | 149 web_contents->GetController().Reload(true); |
| 148 } | 150 } |
| 149 | 151 |
| 150 return true; | 152 return true; |
| 151 } | 153 } |
| OLD | NEW |