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

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

Issue 5574001: Move ContentSettingsDetails and Pattern out of HostContentSettingsMap as separate classes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/chrome/browser/content_settings
Patch Set: rebase Created 10 years 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_details.h
diff --git a/chrome/browser/content_settings/content_settings_details.h b/chrome/browser/content_settings/content_settings_details.h
new file mode 100644
index 0000000000000000000000000000000000000000..b6fdffa26643e33f62b1825eee3dfe456cece9da
--- /dev/null
+++ b/chrome/browser/content_settings/content_settings_details.h
@@ -0,0 +1,58 @@
+// Copyright (c) 2010 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.
+
+// Sends notifications about updates to the content settings.
gfeher 2010/12/02 13:07:50 If I understand correctly, the notification is not
jochen (gone - plz use gerrit) 2010/12/02 13:18:43 Done.
markusheintz_ 2010/12/02 13:28:18 This comment doesn't seem to belong here. Pls remo
+
+#ifndef CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_DETAILS_H_
+#define CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_DETAILS_H_
+#pragma once
+
+#include "base/basictypes.h"
+#include "chrome/browser/content_settings/content_settings_pattern.h"
+#include "chrome/common/content_settings.h"
+
+// Details for the CONTENT_SETTINGS_CHANGED notification. This is sent when
+// content settings change for at least one host. If settings change for more
+// than one pattern in one user interaction, this will usually send a single
markusheintz_ 2010/12/02 13:28:18 [..., this will usually send ...], pls remove "usu
jochen (gone - plz use gerrit) 2010/12/02 13:41:39 well, it's not always the case, i.e. when you chan
markusheintz_ 2010/12/02 13:50:56 But these are several separate actions/changes/req
jochen (gone - plz use gerrit) 2010/12/02 13:55:40 nope, that's not part of the contract
+// notification with update_all() returning true instead of one notification
+// for each pattern.
+class ContentSettingsDetails {
+ public:
+ // Update the setting that matches this pattern/content type/resource.
+ ContentSettingsDetails(const ContentSettingsPattern& pattern,
+ ContentSettingsType type,
+ const std::string& resource_identifier)
+ : pattern_(pattern),
+ type_(type),
+ resource_identifier_(resource_identifier) {}
+
+ // The pattern whose settings have changed.
+ const ContentSettingsPattern& pattern() const { return pattern_; }
+
+ // True if all settings should be updated for the given type.
+ bool update_all() const { return pattern_.AsString().empty(); }
+
+ // The type of the pattern whose settings have changed.
+ ContentSettingsType type() const { return type_; }
+
+ // The resource identifier for the settings type that has changed.
+ const std::string& resource_identifier() const {
+ return resource_identifier_;
+ }
+
+ // True if all types should be updated. If update_all() is false, this will
+ // be false as well (although the reverse does not hold true).
+ bool update_all_types() const {
+ return CONTENT_SETTINGS_TYPE_DEFAULT == type_;
+ }
+
+ private:
+ ContentSettingsPattern pattern_;
+ ContentSettingsType type_;
+ std::string resource_identifier_;
+
+ DISALLOW_COPY_AND_ASSIGN(ContentSettingsDetails);
+};
+
+#endif // CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_DETAILS_H_

Powered by Google App Engine
This is Rietveld 408576698