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> |
11 | 11 |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/time/time.h" | 13 #include "base/time/time.h" |
| 14 #include "chrome/browser/installable/installable_logging.h" |
14 #include "ui/base/page_transition_types.h" | 15 #include "ui/base/page_transition_types.h" |
15 | 16 |
16 namespace content { | 17 namespace content { |
17 class WebContents; | 18 class WebContents; |
18 } // namespace content | 19 } // namespace content |
19 | 20 |
20 class GURL; | 21 class GURL; |
21 class Profile; | 22 class Profile; |
22 | 23 |
23 // Utility class to record banner events for the given package or start url. | 24 // Utility class to record banner events for the given package or start url. |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 | 89 |
89 // Record a banner could show event, with a specified transition type. | 90 // Record a banner could show event, with a specified transition type. |
90 static void RecordBannerCouldShowEvent( | 91 static void RecordBannerCouldShowEvent( |
91 content::WebContents* web_contents, | 92 content::WebContents* web_contents, |
92 const GURL& origin_url, | 93 const GURL& origin_url, |
93 const std::string& package_name_or_start_url, | 94 const std::string& package_name_or_start_url, |
94 base::Time time, | 95 base::Time time, |
95 ui::PageTransition transition_type); | 96 ui::PageTransition transition_type); |
96 | 97 |
97 // Determine if the banner should be shown, given the recorded events for the | 98 // Determine if the banner should be shown, given the recorded events for the |
98 // supplied app. | 99 // supplied app. Returns an InstallableStatusCode indicated the reason why the |
99 static bool ShouldShowBanner(content::WebContents* web_contents, | 100 // banner shouldn't be shown, or NO_ERROR_DETECTED if it should be shown. |
100 const GURL& origin_url, | 101 static InstallableStatusCode ShouldShowBanner( |
101 const std::string& package_name_or_start_url, | 102 content::WebContents* web_contents, |
102 base::Time time); | 103 const GURL& origin_url, |
| 104 const std::string& package_name_or_start_url, |
| 105 base::Time time); |
103 | 106 |
104 // Gets the could have been shown events that are stored for the given package | 107 // Gets the could have been shown events that are stored for the given package |
105 // or start url. This is only exposed for testing. | 108 // or start url. This is only exposed for testing. |
106 static std::vector<BannerEvent> GetCouldShowBannerEvents( | 109 static std::vector<BannerEvent> GetCouldShowBannerEvents( |
107 content::WebContents* web_contents, | 110 content::WebContents* web_contents, |
108 const GURL& origin_url, | 111 const GURL& origin_url, |
109 const std::string& package_name_or_start_url); | 112 const std::string& package_name_or_start_url); |
110 | 113 |
111 // Get the recorded event for an event type that only records the last event. | 114 // Get the recorded event for an event type that only records the last event. |
112 // Should not be used with APP_BANNER_EVENT_COULD_SHOW. This is only exposed | 115 // Should not be used with APP_BANNER_EVENT_COULD_SHOW. This is only exposed |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 | 167 |
165 // Returns true if the app banner trigger condition should use the site | 168 // Returns true if the app banner trigger condition should use the site |
166 // engagement score instead of the navigation-based heuristic. | 169 // engagement score instead of the navigation-based heuristic. |
167 static bool ShouldUseSiteEngagementScore(); | 170 static bool ShouldUseSiteEngagementScore(); |
168 | 171 |
169 private: | 172 private: |
170 DISALLOW_IMPLICIT_CONSTRUCTORS(AppBannerSettingsHelper); | 173 DISALLOW_IMPLICIT_CONSTRUCTORS(AppBannerSettingsHelper); |
171 }; | 174 }; |
172 | 175 |
173 #endif // CHROME_BROWSER_BANNERS_APP_BANNER_SETTINGS_HELPER_H_ | 176 #endif // CHROME_BROWSER_BANNERS_APP_BANNER_SETTINGS_HELPER_H_ |
OLD | NEW |