Chromium Code Reviews| Index: chrome/browser/interstitials/security_interstitial_uma_helper.h |
| diff --git a/chrome/browser/interstitials/security_interstitial_uma_helper.h b/chrome/browser/interstitials/security_interstitial_uma_helper.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..34b0fc79ee6174a5f2c707af8fc9b93b41541ac1 |
| --- /dev/null |
| +++ b/chrome/browser/interstitials/security_interstitial_uma_helper.h |
| @@ -0,0 +1,72 @@ |
| +// Copyright (c) 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_INTERSTITIALS_SECURITY_INTERSTITIAL_UMA_HELPER_H_ |
| +#define CHROME_BROWSER_INTERSTITIALS_SECURITY_INTERSTITIAL_UMA_HELPER_H_ |
| + |
| +#include "base/time/time.h" |
| +#include "chrome/browser/history/history_service.h" |
|
mattm
2015/01/14 00:33:03
This could be in the .cc?
felt
2015/01/14 00:55:18
You're right, moved.
However I had to add:
#inclu
|
| +#include "url/gurl.h" |
| + |
| +#if defined(ENABLE_EXTENSIONS) |
| +#include "chrome/browser/extensions/api/experience_sampling_private/experience_sampling.h" |
|
mattm
2015/01/14 00:33:03
I think you could forward declare extensions::Expe
felt
2015/01/14 00:55:18
Done.
|
| +#endif |
| + |
| +namespace content { |
| +class WebContents; |
| +} |
| + |
| +class SecurityInterstitialUmaHelper { |
| + public: |
| + // These enums are used for histograms. Don't reorder, delete, or insert |
| + // elements. New elements should be added at the end (right before the max). |
| + enum SecurityInterstitialDecision { |
| + SHOW, |
| + PROCEED, |
| + DONT_PROCEED, |
| + PROCEEDING_DISABLED, |
| + MAX_DECISION |
| + }; |
| + enum SecurityInterstitialInteraction { |
| + TOTAL_VISITS, |
| + SHOW_ADVANCED, |
| + SHOW_PRIVACY_POLICY, |
| + SHOW_DIAGNOSTIC, |
| + SHOW_LEARN_MORE, |
| + RELOAD, |
| + OPEN_TIME_SETTINGS, |
| + MAX_INTERACTION |
| + }; |
| + |
| + SecurityInterstitialUmaHelper(content::WebContents* web_contents, |
| + const GURL& url, |
| + const std::string& histogram_prefix, |
| + const std::string& sampling_event_name); |
| + ~SecurityInterstitialUmaHelper(); |
| + |
| + // Record a user decision or interaction to the appropriate UMA histogram. |
| + void RecordUserDecision(SecurityInterstitialDecision decision); |
| + void RecordUserInteraction(SecurityInterstitialInteraction interaction); |
| + |
| +private: |
|
mattm
2015/01/14 00:33:04
indentation
felt
2015/01/14 00:55:18
Done.
|
| + // Used to query the HistoryService to see if the URL is in history. |
| + void OnGotHistoryCount(bool success, int num_visits, base::Time first_visit); |
| + |
| + content::WebContents* web_contents() const; |
| + GURL request_url() const; |
| + |
| + content::WebContents* web_contents_; |
| + const GURL request_url_; |
| + const std::string histogram_prefix_; |
| + const std::string sampling_event_name_; |
| + int num_visits_; |
| + base::CancelableTaskTracker request_tracker_; |
| +#if defined(ENABLE_EXTENSIONS) |
| + scoped_ptr<extensions::ExperienceSamplingEvent> sampling_event_; |
| +#endif |
| + |
| + DISALLOW_COPY_AND_ASSIGN(SecurityInterstitialUmaHelper); |
| +}; |
| + |
| +#endif // CHROME_BROWSER_INTERSTITIALS_SECURITY_INTERSTITIAL_UMA_HELPER_H_ |