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

Side by Side Diff: chrome/common/extensions/url_pattern.h

Issue 199074: Don't allow updating tabs to javascript URLs without host (Closed)
Patch Set: Remove unchanged file Created 11 years, 3 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 #ifndef CHROME_COMMON_EXTENSIONS_URL_PATTERN_H_ 4 #ifndef CHROME_COMMON_EXTENSIONS_URL_PATTERN_H_
5 #define CHROME_COMMON_EXTENSIONS_URL_PATTERN_H_ 5 #define CHROME_COMMON_EXTENSIONS_URL_PATTERN_H_
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "googleurl/src/gurl.h" 9 #include "googleurl/src/gurl.h"
10 10
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 // Gets the host the pattern matches. This can be an empty string if the 91 // Gets the host the pattern matches. This can be an empty string if the
92 // pattern matches all hosts (the input was <scheme>://*/<whatever>). 92 // pattern matches all hosts (the input was <scheme>://*/<whatever>).
93 std::string host() const { return host_; } 93 std::string host() const { return host_; }
94 94
95 // Gets whether to match subdomains of host(). 95 // Gets whether to match subdomains of host().
96 bool match_subdomains() const { return match_subdomains_; } 96 bool match_subdomains() const { return match_subdomains_; }
97 97
98 // Gets the path the pattern matches with the leading slash. This can have 98 // Gets the path the pattern matches with the leading slash. This can have
99 // embedded asterisks which are interpreted using glob rules. 99 // embedded asterisks which are interpreted using glob rules.
100 std::string path() const { return path_; } 100 std::string path() const { return path_; }
101 void set_path(const std::string& path) {
102 path_ = path;
103 path_escaped_ = "";
Erik does not do reviews 2009/09/10 18:23:21 Is this just unimplemented?
Aaron Boodman 2009/09/10 18:55:31 I'm resetting it because the escaped form is compu
104 }
101 105
102 private: 106 private:
103 // Returns true if |test| matches our host. 107 // Returns true if |test| matches our host.
104 bool MatchesHost(const GURL& test) const; 108 bool MatchesHost(const GURL& test) const;
105 109
106 // Returns true if |test| matches our path. 110 // Returns true if |test| matches our path.
107 bool MatchesPath(const GURL& test) const; 111 bool MatchesPath(const GURL& test) const;
108 112
109 // The scheme for the pattern. 113 // The scheme for the pattern.
110 std::string scheme_; 114 std::string scheme_;
111 115
112 // The host without any leading "*" components. 116 // The host without any leading "*" components.
113 std::string host_; 117 std::string host_;
114 118
115 // Whether we should match subdomains of the host. This is true if the first 119 // Whether we should match subdomains of the host. This is true if the first
116 // component of the pattern's host was "*". 120 // component of the pattern's host was "*".
117 bool match_subdomains_; 121 bool match_subdomains_;
118 122
119 // The path to match. This is everything after the host of the URL, or 123 // The path to match. This is everything after the host of the URL, or
120 // everything after the scheme in the case of file:// URLs. 124 // everything after the scheme in the case of file:// URLs.
121 std::string path_; 125 std::string path_;
122 126
123 // The path with "?" and "\" characters escaped for use with the 127 // The path with "?" and "\" characters escaped for use with the
124 // MatchPattern() function. This is populated lazily, the first time it is 128 // MatchPattern() function. This is populated lazily, the first time it is
125 // needed. 129 // needed.
126 mutable std::string path_escaped_; 130 mutable std::string path_escaped_;
127 }; 131 };
128 132
129 #endif // CHROME_COMMON_EXTENSIONS_URL_PATTERN_H_ 133 #endif // CHROME_COMMON_EXTENSIONS_URL_PATTERN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698