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_ANDROID_BANNERS_APP_BANNER_SETTINGS_HELPER_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_SETTINGS_HELPER_H_ |
6 #define CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_SETTINGS_HELPER_H_ | 6 #define CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_SETTINGS_HELPER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/time/time.h" |
11 | 12 |
12 namespace content { | 13 namespace content { |
13 class WebContents; | 14 class WebContents; |
14 } // namesapce content | 15 } // namesapce content |
15 | 16 |
16 class GURL; | 17 class GURL; |
17 | 18 |
18 // Utility class for reading and updating ContentSettings for app banners. | 19 // Utility class for reading and updating ContentSettings for app banners. |
19 class AppBannerSettingsHelper { | 20 class AppBannerSettingsHelper { |
20 public: | 21 public: |
21 // Checks if a URL is allowed to show a banner for the given package. | 22 // Records that a banner could have been shown for the given package or start |
| 23 // url. |
| 24 static void RecordCouldShowBannerEvent( |
| 25 content::WebContents* web_contents, |
| 26 const GURL& origin_url, |
| 27 const std::string& package_name_or_start_url, |
| 28 base::Time time); |
| 29 |
| 30 // Checks if a URL is allowed to show a banner for the given package or start |
| 31 // url. |
22 static bool IsAllowed(content::WebContents* web_contents, | 32 static bool IsAllowed(content::WebContents* web_contents, |
23 const GURL& origin_url, | 33 const GURL& origin_url, |
24 const std::string& package_name); | 34 const std::string& package_name_or_start_url); |
25 | 35 |
26 // Blocks a URL from showing a banner for the given package. | 36 // Blocks a URL from showing a banner for the given package or start url. |
27 static void Block(content::WebContents* web_contents, | 37 static void Block(content::WebContents* web_contents, |
28 const GURL& origin_url, | 38 const GURL& origin_url, |
29 const std::string& package_name); | 39 const std::string& package_name_or_start_url); |
30 | 40 |
31 private: | 41 private: |
32 DISALLOW_COPY_AND_ASSIGN(AppBannerSettingsHelper); | 42 DISALLOW_COPY_AND_ASSIGN(AppBannerSettingsHelper); |
33 }; | 43 }; |
34 | 44 |
35 #endif // CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_SETTINGS_HELPER_H_ | 45 #endif // CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_SETTINGS_HELPER_H_ |
OLD | NEW |