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 11 matching lines...) Expand all Loading... |
22 const char kUMAPreviewsInfoBarActionLoFi[] = "Previews.InfoBarAction.LoFi"; | 22 const char kUMAPreviewsInfoBarActionLoFi[] = "Previews.InfoBarAction.LoFi"; |
23 | 23 |
24 // Key of the UMA Previews.InfoBarAction.Offline histogram. | 24 // Key of the UMA Previews.InfoBarAction.Offline histogram. |
25 const char kUMAPreviewsInfoBarActionOffline[] = | 25 const char kUMAPreviewsInfoBarActionOffline[] = |
26 "Previews.InfoBarAction.Offline"; | 26 "Previews.InfoBarAction.Offline"; |
27 | 27 |
28 // Key of the UMA Previews.InfoBarAction.LitePage histogram. | 28 // Key of the UMA Previews.InfoBarAction.LitePage histogram. |
29 const char kUMAPreviewsInfoBarActionLitePage[] = | 29 const char kUMAPreviewsInfoBarActionLitePage[] = |
30 "Previews.InfoBarAction.LitePage"; | 30 "Previews.InfoBarAction.LitePage"; |
31 | 31 |
32 // Actions on the previews infobar. This enum must remain synchronized with the | |
33 // enum of the same name in metrics/histograms/histograms.xml. | |
34 enum PreviewsInfoBarAction { | |
35 INFOBAR_SHOWN = 0, | |
36 INFOBAR_LOAD_ORIGINAL_CLICKED = 1, | |
37 INFOBAR_DISMISSED_BY_USER = 2, | |
38 INFOBAR_DISMISSED_BY_NAVIGATION = 3, | |
39 INFOBAR_INDEX_BOUNDARY | |
40 }; | |
41 | |
42 void RecordPreviewsInfoBarAction( | 32 void RecordPreviewsInfoBarAction( |
43 PreviewsInfoBarDelegate::PreviewsInfoBarType infobar_type, | 33 PreviewsInfoBarDelegate::PreviewsInfoBarType infobar_type, |
44 PreviewsInfoBarAction action) { | 34 PreviewsInfoBarDelegate::PreviewsInfoBarAction action) { |
45 if (infobar_type == PreviewsInfoBarDelegate::LOFI) { | 35 if (infobar_type == PreviewsInfoBarDelegate::LOFI) { |
46 UMA_HISTOGRAM_ENUMERATION(kUMAPreviewsInfoBarActionLoFi, action, | 36 UMA_HISTOGRAM_ENUMERATION(kUMAPreviewsInfoBarActionLoFi, action, |
47 INFOBAR_INDEX_BOUNDARY); | 37 PreviewsInfoBarDelegate::INFOBAR_INDEX_BOUNDARY); |
48 } else if (infobar_type == PreviewsInfoBarDelegate::LITE_PAGE) { | 38 } else if (infobar_type == PreviewsInfoBarDelegate::LITE_PAGE) { |
49 UMA_HISTOGRAM_ENUMERATION(kUMAPreviewsInfoBarActionLitePage, action, | 39 UMA_HISTOGRAM_ENUMERATION(kUMAPreviewsInfoBarActionLitePage, action, |
50 INFOBAR_INDEX_BOUNDARY); | 40 PreviewsInfoBarDelegate::INFOBAR_INDEX_BOUNDARY); |
51 } else if (infobar_type == PreviewsInfoBarDelegate::OFFLINE) { | 41 } else if (infobar_type == PreviewsInfoBarDelegate::OFFLINE) { |
52 UMA_HISTOGRAM_ENUMERATION(kUMAPreviewsInfoBarActionOffline, action, | 42 UMA_HISTOGRAM_ENUMERATION(kUMAPreviewsInfoBarActionOffline, action, |
53 INFOBAR_INDEX_BOUNDARY); | 43 PreviewsInfoBarDelegate::INFOBAR_INDEX_BOUNDARY); |
54 } | 44 } |
55 } | 45 } |
56 | 46 |
57 } // namespace | 47 } // namespace |
58 | 48 |
59 PreviewsInfoBarDelegate::~PreviewsInfoBarDelegate() {} | 49 PreviewsInfoBarDelegate::~PreviewsInfoBarDelegate() {} |
60 | 50 |
61 // static | 51 // static |
62 void PreviewsInfoBarDelegate::Create(content::WebContents* web_contents, | 52 void PreviewsInfoBarDelegate::Create(content::WebContents* web_contents, |
63 PreviewsInfoBarType infobar_type) { | 53 PreviewsInfoBarType infobar_type) { |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 web_contents->ReloadLoFiImages(); | 131 web_contents->ReloadLoFiImages(); |
142 | 132 |
143 auto* data_reduction_proxy_settings = | 133 auto* data_reduction_proxy_settings = |
144 DataReductionProxyChromeSettingsFactory::GetForBrowserContext( | 134 DataReductionProxyChromeSettingsFactory::GetForBrowserContext( |
145 web_contents->GetBrowserContext()); | 135 web_contents->GetBrowserContext()); |
146 data_reduction_proxy_settings->IncrementLoFiUserRequestsForImages(); | 136 data_reduction_proxy_settings->IncrementLoFiUserRequestsForImages(); |
147 } | 137 } |
148 | 138 |
149 return true; | 139 return true; |
150 } | 140 } |
OLD | NEW |