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

Unified Diff: chrome/browser/subresource_filter/chrome_subresource_filter_client.h

Issue 2795053002: [subresource_filter] Implement the "Smart" UI on Android (Closed)
Patch Set: fix tests Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/subresource_filter/chrome_subresource_filter_client.h
diff --git a/chrome/browser/subresource_filter/chrome_subresource_filter_client.h b/chrome/browser/subresource_filter/chrome_subresource_filter_client.h
index ee8fd02f2c5f3cbdb22693f6343aac92643528fa..75c3493d39887c6a45a61be835a61ab18b1469ff 100644
--- a/chrome/browser/subresource_filter/chrome_subresource_filter_client.h
+++ b/chrome/browser/subresource_filter/chrome_subresource_filter_client.h
@@ -5,11 +5,15 @@
#ifndef CHROME_BROWSER_SUBRESOURCE_FILTER_CHROME_SUBRESOURCE_FILTER_CLIENT_H_
#define CHROME_BROWSER_SUBRESOURCE_FILTER_CHROME_SUBRESOURCE_FILTER_CLIENT_H_
+#include <memory>
+
#include "base/macros.h"
+#include "base/time/clock.h"
#include "components/content_settings/core/common/content_settings.h"
#include "components/subresource_filter/content/browser/subresource_filter_client.h"
class GURL;
+class HostContentSettingsMap;
namespace content {
class WebContents;
@@ -52,6 +56,10 @@ enum SubresourceFilterAction {
// flexible.
kActionContentSettingsWildcardUpdate,
+ // The UI was suppressed due to "smart" logic which tries not to spam the UI
+ // on navigations within a certain time period.
+ kActionUISuppressed,
+
kActionLastEntry
};
@@ -63,14 +71,30 @@ class ChromeSubresourceFilterClient
~ChromeSubresourceFilterClient() override;
// SubresourceFilterClient:
- void ToggleNotificationVisibility(bool visibility) override;
+ void ToggleNotificationVisibility(const GURL& url, bool visibility) override;
bool IsWhitelistedByContentSettings(const GURL& url) override;
void WhitelistByContentSettings(const GURL& url) override;
static void LogAction(SubresourceFilterAction action);
+ bool UsingSmartUI() const;
+
+ void set_clock_for_testing(std::unique_ptr<base::Clock> tick_clock) {
engedy 2017/04/04 13:36:00 nit: Have you considered supplying this in the cto
Charlie Harrison 2017/04/10 14:58:53 Yeah, but it isn't ideal, because we want to reset
engedy 2017/04/12 14:02:50 Acknowledged.
+ clock_ = std::move(tick_clock);
+ }
+
+ bool shown_for_navigation() const { return shown_for_navigation_; }
+
private:
- ContentSetting GetContentSettingForUrl(const GURL& url);
+ // Android specific logic for more intelligent UI.
+ void OnUIShown(const GURL& url);
engedy 2017/04/04 13:36:00 nit: How about OnDidShowUI?
Charlie Harrison 2017/04/10 14:58:53 Done.
+ bool ShouldShowUIForSite(const GURL& url) const;
+
+ HostContentSettingsMap* GetSettingsMap() const;
+
+ // For testing.
engedy 2017/04/04 13:35:59 nit: I find this comment a bit misleading, as this
Charlie Harrison 2017/04/10 14:58:53 Updated the comment.
+ std::unique_ptr<base::Clock> clock_;
+
content::WebContents* web_contents_;
bool shown_for_navigation_;

Powered by Google App Engine
This is Rietveld 408576698