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

Side by Side Diff: chrome/browser/banners/app_banner_settings_helper.h

Issue 2379783002: Instant App Banner logic. (Closed)
Patch Set: Fixing tests. Created 4 years, 2 months 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 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 22 matching lines...) Expand all
33 // The desired effect is to have banners appear once a user has demonstrated 33 // The desired effect is to have banners appear once a user has demonstrated
34 // an ongoing relationship with the app, and not to pester the user too much. 34 // an ongoing relationship with the app, and not to pester the user too much.
35 // 35 //
36 // For most events only the last event is recorded. The exception are the 36 // For most events only the last event is recorded. The exception are the
37 // could show events. For these a list of the events is maintained. At most 37 // could show events. For these a list of the events is maintained. At most
38 // one event is stored per day, and events outside the window the heuristic 38 // one event is stored per day, and events outside the window the heuristic
39 // uses are discarded. Local times are used to enforce these rules, to ensure 39 // uses are discarded. Local times are used to enforce these rules, to ensure
40 // what we count as a day matches what the user perceives to be days. 40 // what we count as a day matches what the user perceives to be days.
41 class AppBannerSettingsHelper { 41 class AppBannerSettingsHelper {
42 public: 42 public:
43 // TODO(mariakhomenko): Rename events to reflect that they are used in more
44 // contexts now.
43 enum AppBannerEvent { 45 enum AppBannerEvent {
44 APP_BANNER_EVENT_COULD_SHOW, 46 APP_BANNER_EVENT_COULD_SHOW,
45 APP_BANNER_EVENT_DID_SHOW, 47 APP_BANNER_EVENT_DID_SHOW,
46 APP_BANNER_EVENT_DID_BLOCK, 48 APP_BANNER_EVENT_DID_BLOCK,
47 APP_BANNER_EVENT_DID_ADD_TO_HOMESCREEN, 49 APP_BANNER_EVENT_DID_ADD_TO_HOMESCREEN,
48 APP_BANNER_EVENT_NUM_EVENTS, 50 APP_BANNER_EVENT_NUM_EVENTS,
49 }; 51 };
50 52
51 enum AppBannerRapporMetric { 53 enum AppBannerRapporMetric {
52 WEB, 54 WEB,
53 NATIVE, 55 NATIVE,
54 }; 56 };
55 57
58 static const char kInstantAppsKey[];
59
56 // BannerEvents record the time that a site was accessed, along with an 60 // BannerEvents record the time that a site was accessed, along with an
57 // engagement weight representing the importance of the access. 61 // engagement weight representing the importance of the access.
58 struct BannerEvent { 62 struct BannerEvent {
59 base::Time time; 63 base::Time time;
60 double engagement; 64 double engagement;
61 }; 65 };
62 66
63 // The content setting basically records a simplified subset of history. 67 // The content setting basically records a simplified subset of history.
64 // For privacy reasons this needs to be cleared. The ClearHistoryForURLs 68 // For privacy reasons this needs to be cleared. The ClearHistoryForURLs
65 // function removes any information from the banner content settings for the 69 // function removes any information from the banner content settings for the
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 171
168 // Returns true if the app banner trigger condition should use the site 172 // Returns true if the app banner trigger condition should use the site
169 // engagement score instead of the navigation-based heuristic. 173 // engagement score instead of the navigation-based heuristic.
170 static bool ShouldUseSiteEngagementScore(); 174 static bool ShouldUseSiteEngagementScore();
171 175
172 private: 176 private:
173 DISALLOW_IMPLICIT_CONSTRUCTORS(AppBannerSettingsHelper); 177 DISALLOW_IMPLICIT_CONSTRUCTORS(AppBannerSettingsHelper);
174 }; 178 };
175 179
176 #endif // CHROME_BROWSER_BANNERS_APP_BANNER_SETTINGS_HELPER_H_ 180 #endif // CHROME_BROWSER_BANNERS_APP_BANNER_SETTINGS_HELPER_H_
OLDNEW
« no previous file with comments | « chrome/browser/banners/app_banner_manager.cc ('k') | chrome/browser/banners/app_banner_settings_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698