Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 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 static void RecordCouldShowBannerEvent( | |
| 28 content::WebContents* web_contents, | |
| 29 const GURL& origin_url, | |
| 30 const std::string& package_name_or_start_url, | |
| 31 base::Time time); | |
| 32 | |
| 33 // Gets the could have been shown events that are stored for the given package | |
| 34 // or start url. This is only used for testing. | |
| 35 static std::vector<base::Time> GetCouldShowBannerEvents( | |
| 36 content::WebContents* web_contents, | |
| 37 const GURL& origin_url, | |
| 38 const std::string& package_name_or_start_url); | |
| 39 | |
| 40 // Checks if a URL is allowed to show a banner for the given package or start | |
| 41 // url. | |
| 42 static bool IsAllowed(content::WebContents* web_contents, | |
| 43 const GURL& origin_url, | |
| 44 const std::string& package_name_or_start_url); | |
| 45 | |
| 46 // Blocks a URL from showing a banner for the given package or start url. | |
| 47 static void Block(content::WebContents* web_contents, | |
| 48 const GURL& origin_url, | |
| 49 const std::string& package_name_or_start_url); | |
| 50 | |
| 51 private: | |
| 52 DISALLOW_COPY_AND_ASSIGN(AppBannerSettingsHelper); | |
|
Bernhard Bauer
2015/01/30 13:25:26
You probably also want to disallow the empty const
benwells
2015/01/30 20:47:28
Done. This should probably stop being a class at s
| |
| 53 }; | |
| 54 | |
| 55 #endif // CHROME_BROWSER_BANNERS_APP_BANNER_SETTINGS_HELPER_H_ | |
| OLD | NEW |