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

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

Issue 884373002: Update content setting for app banners to store more information. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Mac test failure Created 5 years, 10 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
« no previous file with comments | « chrome/browser/banners/OWNERS ('k') | chrome/browser/banners/app_banner_settings_helper.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
Lei Zhang 2015/02/02 19:50:13 It's 2015
benwells 2015/02/03 02:33:45 This file has been moved from chrome/browser/andro
Lei Zhang 2015/02/03 02:39:38 Oh, for some reason the file's status is "A" inste
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_BANNERS_APP_BANNER_SETTINGS_HELPER_H_
6 #define CHROME_BROWSER_BANNERS_APP_BANNER_SETTINGS_HELPER_H_
7
8 #include <string>
9 #include <vector>
10
11 #include "base/macros.h"
12 #include "base/time/time.h"
13
14 namespace content {
15 class WebContents;
16 } // namespace content
17
18 class GURL;
19
20 // Utility class for reading and updating ContentSettings for app banners.
21 class AppBannerSettingsHelper {
22 public:
23 // TODO(benwells): Use this method to implement smarter triggering logic.
24 // See http://crbug.com/452825.
25 // Records that a banner could have been shown for the given package or start
26 // url.
27 //
28 // These events are used to decide when banners should be shown, using a
29 // heuristic based on how many different days in a recent period of time (for
30 // example the past two weeks) the banner could have been shown. The desired
31 // effect is to have banners appear once a user has demonstrated an ongoing
32 // relationship with the app.
33 //
34 // At most one event is stored per day, and events outside the window the
35 // heuristic uses are discarded. Local times are used to enforce these rules,
36 // to ensure what we count as a day matches what the user perceives to be
37 // days.
38 static void RecordCouldShowBannerEvent(
39 content::WebContents* web_contents,
40 const GURL& origin_url,
41 const std::string& package_name_or_start_url,
42 base::Time time);
43
44 // Gets the could have been shown events that are stored for the given package
45 // or start url. This is only used for testing.
46 static std::vector<base::Time> GetCouldShowBannerEvents(
47 content::WebContents* web_contents,
48 const GURL& origin_url,
49 const std::string& package_name_or_start_url);
50
51 // Checks if a URL is allowed to show a banner for the given package or start
52 // url.
53 static bool IsAllowed(content::WebContents* web_contents,
54 const GURL& origin_url,
55 const std::string& package_name_or_start_url);
56
57 // Blocks a URL from showing a banner for the given package or start url.
58 static void Block(content::WebContents* web_contents,
59 const GURL& origin_url,
60 const std::string& package_name_or_start_url);
61
62 private:
63 DISALLOW_IMPLICIT_CONSTRUCTORS(AppBannerSettingsHelper);
64 };
65
66 #endif // CHROME_BROWSER_BANNERS_APP_BANNER_SETTINGS_HELPER_H_
OLDNEW
« no previous file with comments | « chrome/browser/banners/OWNERS ('k') | chrome/browser/banners/app_banner_settings_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698