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

Unified Diff: chrome/browser/content_settings/content_settings_abstract_provider.h

Issue 7344008: Make the hcsm and its providers communicate via an observer interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: " Created 9 years, 5 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/content_settings/content_settings_abstract_provider.h
diff --git a/chrome/browser/content_settings/content_settings_abstract_provider.h b/chrome/browser/content_settings/content_settings_abstract_provider.h
new file mode 100644
index 0000000000000000000000000000000000000000..71f05dc82119015c47bd97417a4c1bcc0272b714
--- /dev/null
+++ b/chrome/browser/content_settings/content_settings_abstract_provider.h
@@ -0,0 +1,60 @@
+// Copyright (c) 2011 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_CONTENT_SETTINGS_CONTENT_SETTINGS_ABSTRACT_PROVIDER_H_
+#define CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_ABSTRACT_PROVIDER_H_
+
+#include <set>
+
+#include "chrome/browser/content_settings/content_settings_details.h"
+#include "chrome/browser/content_settings/content_settings_provider.h"
+#include "chrome/browser/content_settings/content_settings_observer.h"
+
+namespace content_settings {
+
+class AbstractProvider : public ProviderInterface {
Bernhard Bauer 2011/07/13 07:58:18 Seeing as this class mainly manages Observers, may
markusheintz_ 2011/07/13 12:48:16 How about ObservableProvider as the provider can b
Bernhard Bauer 2011/07/13 13:21:28 Sounds good.
markusheintz_ 2011/07/13 14:14:42 Done.
+ public:
+ typedef std::set<Observer*> ObserverSet;
+
+ AbstractProvider();
+ virtual ~AbstractProvider();
+
+ void AddObserver(Observer* observer);
+ void RemoveObserver(Observer* observer);
+
+ // ProviderInterface implementation
Bernhard Bauer 2011/07/13 07:58:18 Do you need to declare these methods again?
markusheintz_ 2011/07/13 12:48:16 No I just though it might be helpful for people to
+ virtual ContentSetting GetContentSetting(
+ const GURL& primary_url,
+ const GURL& secondary_url,
+ ContentSettingsType content_type,
+ const ResourceIdentifier& resource_identifier) const = 0;
+
+ virtual void SetContentSetting(
+ const ContentSettingsPattern& primary_pattern,
+ const ContentSettingsPattern& secondary_pattern,
+ ContentSettingsType content_type,
+ const ResourceIdentifier& resource_identifier,
+ ContentSetting content_setting) = 0;
+
+ virtual void GetAllContentSettingsRules(
+ ContentSettingsType content_type,
+ const ResourceIdentifier& resource_identifier,
+ Rules* content_setting_rules) const = 0;
+
+ virtual void ClearAllContentSettingsRules(
+ ContentSettingsType content_type) = 0;
+
+ virtual void ShutdownOnUIThread() = 0;
+
+ protected:
+ void NotifyObservers(const ContentSettingsDetails& details) const;
+ void RemoveAllObserver();
Bernhard Bauer 2011/07/13 07:58:18 This method name should read |RemoveAllObservers|
markusheintz_ 2011/07/13 12:48:16 Done.
+
+ private:
+ ObserverSet observers_;
+};
+
+} // namespace content_settings
+
+#endif // CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_ABSTRACT_PROVIDER_H_

Powered by Google App Engine
This is Rietveld 408576698