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

Unified Diff: chrome/common/content_settings_pattern.h

Issue 8334020: Check for default content setting pattern when requiring user authorization for plug-ins. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review Created 9 years, 2 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
« no previous file with comments | « chrome/browser/tab_contents/tab_contents_ssl_helper.cc ('k') | chrome/common/content_settings_pattern.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/content_settings_pattern.h
diff --git a/chrome/common/content_settings_pattern.h b/chrome/common/content_settings_pattern.h
index 7838141046611aa76d7be807213cb0e66bb1bb21..6d61954e44689969ffb6cc69f4984860fd382014 100644
--- a/chrome/common/content_settings_pattern.h
+++ b/chrome/common/content_settings_pattern.h
@@ -12,6 +12,7 @@
#include <string>
#include "base/basictypes.h"
+#include "base/gtest_prod_util.h"
class GURL;
@@ -19,6 +20,10 @@ namespace content_settings {
class PatternParser;
}
+namespace IPC {
+class Message;
+}
+
// A pattern used in content setting rules. See |IsValid| for a description of
// possible patterns.
class ContentSettingsPattern {
@@ -55,6 +60,40 @@ class ContentSettingsPattern {
DISJOINT_ORDER_PRE = 2,
};
+ struct PatternParts {
+ PatternParts();
+ ~PatternParts();
+
+ // Lowercase string of the URL scheme to match. This string is empty if the
+ // |is_scheme_wildcard| flag is set.
+ std::string scheme;
+
+ // True if the scheme wildcard is set.
+ bool is_scheme_wildcard;
+
+ // Normalized string that is either of the following:
+ // - IPv4 or IPv6
+ // - hostname
+ // - domain
+ // - empty string if the |is_host_wildcard flag is set.
+ std::string host;
+
+ // True if the domain wildcard is set.
+ bool has_domain_wildcard;
+
+ // String with the port to match. This string is empty if the
+ // |is_port_wildcard| flag is set.
+ std::string port;
+
+ // True if the port wildcard is set.
+ bool is_port_wildcard;
+
+ // TODO(markusheintz): Needed for legacy reasons. Remove. Path
+ // specification. Only used for content settings pattern with a "file"
+ // scheme part.
+ std::string path;
+ };
+
class BuilderInterface {
public:
virtual ~BuilderInterface() {}
@@ -120,6 +159,10 @@ class ContentSettingsPattern {
// patterns match nothing.
ContentSettingsPattern();
+ // Serializes the pattern to an IPC message or deserializes it.
+ void WriteToMessage(IPC::Message* m) const;
+ bool ReadFromMessage(const IPC::Message* m, void** iter);
+
// True if this is a valid pattern.
bool IsValid() const { return is_valid_; }
@@ -147,42 +190,8 @@ class ContentSettingsPattern {
private:
friend class content_settings::PatternParser;
- friend class ContentSettingsPatternParserTest_SerializePatterns_Test;
friend class Builder;
-
- struct PatternParts {
- PatternParts();
- ~PatternParts();
-
- // Lowercase string of the URL scheme to match. This string is empty if the
- // |is_scheme_wildcard| flag is set.
- std::string scheme;
-
- // True if the scheme wildcard is set.
- bool is_scheme_wildcard;
-
- // Normalized string that is either of the following:
- // - IPv4 or IPv6
- // - hostname
- // - domain
- // - empty string if the |is_host_wildcard flag is set.
- std::string host;
-
- // True if the domain wildcard is set.
- bool has_domain_wildcard;
-
- // String with the port to match. This string is empty if the
- // |is_port_wildcard| flag is set.
- std::string port;
-
- // True if the port wildcard is set.
- bool is_port_wildcard;
-
- // TODO(markusheintz): Needed for legacy reasons. Remove. Path
- // specification. Only used for content settings pattern with a "file"
- // scheme part.
- std::string path;
- };
+ FRIEND_TEST_ALL_PREFIXES(ContentSettingsPatternParserTest, SerializePatterns);
class Builder : public BuilderInterface {
public:
« no previous file with comments | « chrome/browser/tab_contents/tab_contents_ssl_helper.cc ('k') | chrome/common/content_settings_pattern.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698