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

Side by Side Diff: chrome/browser/privacy_blacklist/blacklist.cc

Issue 159199: Load Multiple Blacklists... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 4 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 4
5 #include "chrome/browser/privacy_blacklist/blacklist.h" 5 #include "chrome/browser/privacy_blacklist/blacklist.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 9
10 #include "base/file_path.h" 10 #include "base/file_path.h"
11 #include "base/file_util.h" 11 #include "base/file_util.h"
12 #include "base/string_util.h" 12 #include "base/string_util.h"
13 #include "chrome/browser/privacy_blacklist/blacklist_store.h" 13 #include "chrome/browser/privacy_blacklist/blacklist_store.h"
14 #include "chrome/common/url_constants.h" 14 #include "chrome/common/url_constants.h"
15 #include "net/http/http_util.h" 15 #include "net/http/http_util.h"
16 16
17 #define STRINGIZE(s) #s 17 #define STRINGIZE(s) #s
18 18
19 namespace { 19 namespace {
20 20
21 const char* const cookie_headers[2] = { "cookie", "set-cookie" }; 21 const char* const cookie_headers[2] = { "cookie", "set-cookie" };
22 22
23 } // namespace 23 } // namespace
24 24
25 const unsigned int Blacklist::kBlockAll = 1;
26 const unsigned int Blacklist::kDontSendCookies = 1 << 1;
27 const unsigned int Blacklist::kDontStoreCookies = 1 << 2;
28 const unsigned int Blacklist::kDontPersistCookies = 1 << 3;
29 const unsigned int Blacklist::kDontSendReferrer = 1 << 4;
30 const unsigned int Blacklist::kDontSendUserAgent = 1 << 5;
31 const unsigned int Blacklist::kBlockByType = 1 << 6;
32 const unsigned int Blacklist::kBlockUnsecure = 1 << 7;
33 const unsigned int Blacklist::kBlockRequest = kBlockAll | kBlockUnsecure;
34 const unsigned int Blacklist::kBlockResponse = kBlockByType;
35 const unsigned int Blacklist::kModifySentHeaders =
36 kDontSendCookies | kDontSendUserAgent | kDontSendReferrer;
37 const unsigned int Blacklist::kModifyReceivedHeaders =
38 kDontPersistCookies | kDontStoreCookies;
39 const unsigned int Blacklist::kFilterByHeaders =
40 kModifyReceivedHeaders | kBlockByType;
41
25 // Value is not important, here just that the object has an address. 42 // Value is not important, here just that the object has an address.
26 const void* const Blacklist::kRequestDataKey = 0; 43 const void* const Blacklist::kRequestDataKey = 0;
27 44
28 unsigned int Blacklist::String2Attribute(const std::string& s) { 45 unsigned int Blacklist::String2Attribute(const std::string& s) {
29 if (s == STRINGIZE(kBlockAll)) 46 if (s == STRINGIZE(kBlockAll))
30 return kBlockAll; 47 return kBlockAll;
31 else if (s == STRINGIZE(kDontSendCookies)) 48 else if (s == STRINGIZE(kDontSendCookies))
32 return kDontSendCookies; 49 return kDontSendCookies;
33 else if (s == STRINGIZE(kDontStoreCookies)) 50 else if (s == STRINGIZE(kDontStoreCookies))
34 return kDontStoreCookies; 51 return kDontStoreCookies;
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 return cookie; 236 return cookie;
220 237
221 std::string session_cookie(cookie, 0, i); 238 std::string session_cookie(cookie, 0, i);
222 std::string::size_type end = cookie.find(';', start + 1); 239 std::string::size_type end = cookie.find(';', start + 1);
223 if (end != std::string::npos) 240 if (end != std::string::npos)
224 session_cookie.append(cookie.substr(end)); 241 session_cookie.append(cookie.substr(end));
225 return session_cookie; 242 return session_cookie;
226 } 243 }
227 return cookie; 244 return cookie;
228 } 245 }
OLDNEW
« no previous file with comments | « chrome/browser/privacy_blacklist/blacklist.h ('k') | chrome/browser/privacy_blacklist/blacklist_io.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698