Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(95)

Side by Side Diff: chrome/browser/previews/previews_infobar_delegate.cc

Issue 2557113004: Seperate reloads when reporting previews infobar dismissal (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698