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

Unified Diff: chrome/browser/notifications/notification_content_settings_provider_android.h

Issue 2886433002: [Android] Adding content settings provider for notification channels (Closed)
Patch Set: Responding to more comments Created 3 years, 7 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/notifications/notification_content_settings_provider_android.h
diff --git a/chrome/browser/notifications/notification_content_settings_provider_android.h b/chrome/browser/notifications/notification_content_settings_provider_android.h
new file mode 100644
index 0000000000000000000000000000000000000000..a7bd95980fbaa9eab23cec7158d7ccafb1b4bc00
--- /dev/null
+++ b/chrome/browser/notifications/notification_content_settings_provider_android.h
@@ -0,0 +1,51 @@
+// Copyright 2017 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_NOTIFICATIONS_NOTIFICATION_CONTENT_SETTINGS_PROVIDER_ANDROID_H_
+#define CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_CONTENT_SETTINGS_PROVIDER_ANDROID_H_
+
+#include <string>
+
+#include "base/macros.h"
+#include "components/content_settings/core/browser/content_settings_observable_provider.h"
+#include "components/content_settings/core/browser/content_settings_observer.h"
+#include "components/content_settings/core/browser/content_settings_rule.h"
+#include "components/content_settings/core/common/content_settings.h"
+#include "components/content_settings/core/common/content_settings_types.h"
+#include "components/keyed_service/core/keyed_service.h"
+
+// This class provides notification content settings from system notification
+// channels on Android O+. This provider takes precedence over pref-provided
+// content settings, but defers to supervised user and policy settings - see
+// ordering of the ProviderType enum values in HostContentSettingsMap.
+class NotificationContentSettingsProviderAndroid
+ : public content_settings::ObservableProvider {
+ public:
+ NotificationContentSettingsProviderAndroid();
+ ~NotificationContentSettingsProviderAndroid() override;
+
+ // ProviderInterface methods:
+ std::unique_ptr<content_settings::RuleIterator> GetRuleIterator(
+ ContentSettingsType content_type,
+ const content_settings::ResourceIdentifier& resource_identifier,
+ bool incognito) const override;
+
+ bool SetWebsiteSetting(
+ const ContentSettingsPattern& primary_pattern,
+ const ContentSettingsPattern& secondary_pattern,
+ ContentSettingsType content_type,
+ const content_settings::ResourceIdentifier& resource_identifier,
+ base::Value* value) override;
+
+ void ClearAllContentSettingsRules(ContentSettingsType content_type) override;
+
+ void ShutdownOnUIThread() override;
+
+ private:
+ bool should_use_channels_;
+
+ DISALLOW_COPY_AND_ASSIGN(NotificationContentSettingsProviderAndroid);
+};
+
+#endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_CONTENT_SETTINGS_PROVIDER_ANDROID_H_

Powered by Google App Engine
This is Rietveld 408576698