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

Side by Side Diff: chrome/browser/policy/url_blacklist_manager.h

Issue 7930011: Readability review for joaodasilva (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 4
5 #ifndef CHROME_BROWSER_POLICY_URL_BLACKLIST_MANAGER_H_ 5 #ifndef CHROME_BROWSER_POLICY_URL_BLACKLIST_MANAGER_H_
6 #define CHROME_BROWSER_POLICY_URL_BLACKLIST_MANAGER_H_ 6 #define CHROME_BROWSER_POLICY_URL_BLACKLIST_MANAGER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 12 matching lines...) Expand all
23 class NotificationSource; 23 class NotificationSource;
24 class PrefService; 24 class PrefService;
25 25
26 namespace base { 26 namespace base {
27 class ListValue; 27 class ListValue;
28 } 28 }
29 29
30 namespace policy { 30 namespace policy {
31 31
32 // Contains a set of filters to block and allow certain URLs, and matches GURLs 32 // Contains a set of filters to block and allow certain URLs, and matches GURLs
33 // against this set. The filters are currently kept in memory. 33 // against this set. The filters are currently kept in memory.
zunger 2011/10/20 22:24:03 What's the thread-safety of this class?
Joao da Silva 2011/10/21 10:19:47 It's not thread safe. After setting up all the fil
34 class URLBlacklist { 34 class URLBlacklist {
35 public: 35 public:
36 URLBlacklist(); 36 URLBlacklist();
37 virtual ~URLBlacklist(); 37 virtual ~URLBlacklist();
38 38
39 // URLs matching |filter| will be blocked. 39 // URLs matching |filter| will be blocked.
zunger 2011/10/20 22:24:03 Are these exact URLs? Is any normalization done?
Joao da Silva 2011/10/21 10:19:47 Most URLs are valid filters, with a couple of exce
40 void Block(const std::string& filter); 40 void Block(const std::string& filter);
41 41
42 // URLs matching |filter| will be allowed. If |filter| is both Blocked and 42 // URLs matching |filter| will be allowed. If |filter| is both Blocked and
43 // Allowed, Allow takes precedence. 43 // Allowed, Allow takes precedence.
44 void Allow(const std::string& filter); 44 void Allow(const std::string& filter);
45 45
46 // Returns true if the URL is blocked. 46 // Returns true if the URL is blocked.
47 bool IsURLBlocked(const GURL& url) const; 47 bool IsURLBlocked(const GURL& url) const;
48 48
49 // A constant mapped to a scheme that can be filtered. 49 // A constant mapped to a scheme that can be filtered.
(...skipping 16 matching lines...) Expand all
66 // |port| is 0 if none is explicitly defined. 66 // |port| is 0 if none is explicitly defined.
67 // |path| does not include query parameters. 67 // |path| does not include query parameters.
68 static bool FilterToComponents(const std::string& filter, 68 static bool FilterToComponents(const std::string& filter,
69 std::string* scheme, 69 std::string* scheme,
70 std::string* host, 70 std::string* host,
71 uint16* port, 71 uint16* port,
72 std::string* path); 72 std::string* path);
73 private: 73 private:
74 void AddFilter(const std::string& filter, bool block); 74 void AddFilter(const std::string& filter, bool block);
75 75
76 struct PathFilter { 76 struct PathFilter {
zunger 2011/10/20 22:24:03 You can move this entire declaration into the .cc
Joao da Silva 2011/10/21 10:19:47 Done.
77 explicit PathFilter(const std::string& path, uint16 port, bool match) 77 explicit PathFilter(const std::string& path, uint16 port, bool match)
78 : path_prefix(path), 78 : path_prefix(path),
79 port(port), 79 port(port),
80 blocked_schemes(0), 80 blocked_schemes(0),
81 allowed_schemes(0), 81 allowed_schemes(0),
82 match_subdomains(match) {} 82 match_subdomains(match) {}
83 83
84 std::string path_prefix; 84 std::string path_prefix;
85 uint16 port; 85 uint16 port;
86 uint8 blocked_schemes; 86 uint8 blocked_schemes;
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 170
171 // The current blacklist. 171 // The current blacklist.
172 scoped_ptr<URLBlacklist> blacklist_; 172 scoped_ptr<URLBlacklist> blacklist_;
173 173
174 DISALLOW_COPY_AND_ASSIGN(URLBlacklistManager); 174 DISALLOW_COPY_AND_ASSIGN(URLBlacklistManager);
175 }; 175 };
176 176
177 } // namespace policy 177 } // namespace policy
178 178
179 #endif // CHROME_BROWSER_POLICY_URL_BLACKLIST_MANAGER_H_ 179 #endif // CHROME_BROWSER_POLICY_URL_BLACKLIST_MANAGER_H_
180
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/policy/url_blacklist_manager.cc » ('j') | chrome/browser/policy/url_blacklist_manager.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698