Chromium Code Reviews| Index: chrome/browser/banners/app_banner_settings_helper.h |
| diff --git a/chrome/browser/banners/app_banner_settings_helper.h b/chrome/browser/banners/app_banner_settings_helper.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..1986a89e584a5e4cf6edb05e237132344825ffb2 |
| --- /dev/null |
| +++ b/chrome/browser/banners/app_banner_settings_helper.h |
| @@ -0,0 +1,55 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_BANNERS_APP_BANNER_SETTINGS_HELPER_H_ |
| +#define CHROME_BROWSER_BANNERS_APP_BANNER_SETTINGS_HELPER_H_ |
| + |
| +#include <string> |
| +#include <vector> |
| + |
| +#include "base/macros.h" |
| +#include "base/time/time.h" |
| + |
| +namespace content { |
| +class WebContents; |
| +} // namespace content |
| + |
| +class GURL; |
| + |
| +// Utility class for reading and updating ContentSettings for app banners. |
| +class AppBannerSettingsHelper { |
| + public: |
| + // TODO(benwells): Use this method to implement smarter triggering logic. |
| + // See http://crbug.com/452825. |
| + // Records that a banner could have been shown for the given package or start |
| + // url. |
| + static void RecordCouldShowBannerEvent( |
| + content::WebContents* web_contents, |
| + const GURL& origin_url, |
| + const std::string& package_name_or_start_url, |
| + base::Time time); |
| + |
| + // Gets the could have been shown events that are stored for the given package |
| + // or start url. This is only used for testing. |
| + static std::vector<base::Time> GetCouldShowBannerEvents( |
| + content::WebContents* web_contents, |
| + const GURL& origin_url, |
| + const std::string& package_name_or_start_url); |
| + |
| + // Checks if a URL is allowed to show a banner for the given package or start |
| + // url. |
| + static bool IsAllowed(content::WebContents* web_contents, |
| + const GURL& origin_url, |
| + const std::string& package_name_or_start_url); |
| + |
| + // Blocks a URL from showing a banner for the given package or start url. |
| + static void Block(content::WebContents* web_contents, |
| + const GURL& origin_url, |
| + const std::string& package_name_or_start_url); |
| + |
| + private: |
| + 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
|
| +}; |
| + |
| +#endif // CHROME_BROWSER_BANNERS_APP_BANNER_SETTINGS_HELPER_H_ |