| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef CHROME_BROWSER_BANNERS_APP_BANNER_SETTINGS_HELPER_H_ | 5 #ifndef CHROME_BROWSER_BANNERS_APP_BANNER_SETTINGS_HELPER_H_ |
| 6 #define CHROME_BROWSER_BANNERS_APP_BANNER_SETTINGS_HELPER_H_ | 6 #define CHROME_BROWSER_BANNERS_APP_BANNER_SETTINGS_HELPER_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 class AppBannerSettingsHelper { | 39 class AppBannerSettingsHelper { |
| 40 public: | 40 public: |
| 41 enum AppBannerEvent { | 41 enum AppBannerEvent { |
| 42 APP_BANNER_EVENT_COULD_SHOW, | 42 APP_BANNER_EVENT_COULD_SHOW, |
| 43 APP_BANNER_EVENT_DID_SHOW, | 43 APP_BANNER_EVENT_DID_SHOW, |
| 44 APP_BANNER_EVENT_DID_BLOCK, | 44 APP_BANNER_EVENT_DID_BLOCK, |
| 45 APP_BANNER_EVENT_DID_ADD_TO_HOMESCREEN, | 45 APP_BANNER_EVENT_DID_ADD_TO_HOMESCREEN, |
| 46 APP_BANNER_EVENT_NUM_EVENTS, | 46 APP_BANNER_EVENT_NUM_EVENTS, |
| 47 }; | 47 }; |
| 48 | 48 |
| 49 enum AppBannerRapporMetric { |
| 50 WEB, |
| 51 NATIVE, |
| 52 }; |
| 53 |
| 49 // The content setting basically records a simplified subset of history. | 54 // The content setting basically records a simplified subset of history. |
| 50 // For privacy reasons this needs to be cleared. The ClearHistoryForURLs | 55 // For privacy reasons this needs to be cleared. The ClearHistoryForURLs |
| 51 // function removes any information from the banner content settings for the | 56 // function removes any information from the banner content settings for the |
| 52 // given URls. | 57 // given URls. |
| 53 static void ClearHistoryForURLs(Profile* profile, | 58 static void ClearHistoryForURLs(Profile* profile, |
| 54 const std::set<GURL>& origin_urls); | 59 const std::set<GURL>& origin_urls); |
| 55 | 60 |
| 61 // Record a banner installation event, for either a WEB or NATIVE app. |
| 62 static void RecordBannerInstallEvent( |
| 63 content::WebContents* web_contents, |
| 64 const std::string& package_name_or_start_url, |
| 65 AppBannerRapporMetric rappor_metric); |
| 66 |
| 67 // Record a banner dismissal event, for either a WEB or NATIVE app. |
| 68 static void RecordBannerDismissEvent( |
| 69 content::WebContents* web_contents, |
| 70 const std::string& package_name_or_start_url, |
| 71 AppBannerRapporMetric rappor_metric); |
| 72 |
| 56 static void RecordBannerEvent(content::WebContents* web_contents, | 73 static void RecordBannerEvent(content::WebContents* web_contents, |
| 57 const GURL& origin_url, | 74 const GURL& origin_url, |
| 58 const std::string& package_name_or_start_url, | 75 const std::string& package_name_or_start_url, |
| 59 AppBannerEvent event, | 76 AppBannerEvent event, |
| 60 base::Time time); | 77 base::Time time); |
| 61 | 78 |
| 62 // Determine if the banner should be shown, given the recorded events for the | 79 // Determine if the banner should be shown, given the recorded events for the |
| 63 // supplied app. | 80 // supplied app. |
| 64 static bool ShouldShowBanner(content::WebContents* web_contents, | 81 static bool ShouldShowBanner(content::WebContents* web_contents, |
| 65 const GURL& origin_url, | 82 const GURL& origin_url, |
| (...skipping 14 matching lines...) Expand all Loading... |
| 80 content::WebContents* web_contents, | 97 content::WebContents* web_contents, |
| 81 const GURL& origin_url, | 98 const GURL& origin_url, |
| 82 const std::string& package_name_or_start_url, | 99 const std::string& package_name_or_start_url, |
| 83 AppBannerEvent event); | 100 AppBannerEvent event); |
| 84 | 101 |
| 85 private: | 102 private: |
| 86 DISALLOW_IMPLICIT_CONSTRUCTORS(AppBannerSettingsHelper); | 103 DISALLOW_IMPLICIT_CONSTRUCTORS(AppBannerSettingsHelper); |
| 87 }; | 104 }; |
| 88 | 105 |
| 89 #endif // CHROME_BROWSER_BANNERS_APP_BANNER_SETTINGS_HELPER_H_ | 106 #endif // CHROME_BROWSER_BANNERS_APP_BANNER_SETTINGS_HELPER_H_ |
| OLD | NEW |