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

Side by Side Diff: chrome/browser/privacy_blacklist/blocked_response.h

Issue 252001: Privacy Blacklist Unblock... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/privacy_blacklist/blocked_response.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #ifndef CHROME_BROWSER_PRIVACY_BLACKLIST_BLOCKED_RESPONSE_H_ 5 #ifndef CHROME_BROWSER_PRIVACY_BLACKLIST_BLOCKED_RESPONSE_H_
6 #define CHROME_BROWSER_PRIVACY_BLACKLIST_BLOCKED_RESPONSE_H_ 6 #define CHROME_BROWSER_PRIVACY_BLACKLIST_BLOCKED_RESPONSE_H_
7 7
8 #include <string> 8 #include <string>
9 #include <set>
9 10
10 #include "chrome/browser/privacy_blacklist/blacklist.h" 11 #include "chrome/browser/privacy_blacklist/blacklist.h"
11 12
13 namespace chrome {
14
15 extern const char kUnblockScheme[];
16 extern const char kBlockScheme[];
17
12 // Generate localized responses to replace blacklisted resources. 18 // Generate localized responses to replace blacklisted resources.
13 // Blacklisted resources such as frames and iframes are replaced 19 // Blacklisted resources such as frames and iframes are replaced
14 // by HTML. Non visual resources such as Javascript and CSS are 20 // by HTML. Non visual resources such as Javascript and CSS are
15 // simply be cancelled so there is no blocked response for them. 21 // simply be cancelled so there is no blocked response for them.
16 22
17 namespace BlockedResponse { 23 class BlockedResponse {
24 public:
25 BlockedResponse() {};
18 26
19 // Returns the HTML document used as substituted content for blacklisted 27 // Returns the HTML document used as substituted content for blacklisted
20 // elements. 28 // elements.
21 std::string GetHTML(const Blacklist::Match* match); 29 std::string GetHTML(const std::string& url, const Blacklist::Match* match);
22 30
23 // Returns the image (as a string because that is what is expected by callers) 31 // Returns the image (as a string because that is what is expected by callers)
24 // used as substituted content for blacklisted elements. 32 // used as substituted content for blacklisted elements.
25 std::string GetImage(const Blacklist::Match* match); 33 std::string GetImage(const Blacklist::Match* match);
26 34
27 } // namespace BlockedResponse 35 // Returns HTTP headers for a blocked response replacing the given url.
36 std::string GetHeaders(const std::string& url);
37
38 // Gets the original url of a blocked resource from its blocked url.
39 // The input must be a chome-unblock://XXX url. If the unblock url is
40 // not found, then about:blank is returned.
41 std::string GetOriginalURL(const std::string& url);
42
43 private:
44 // Returns a chrome-block://XXX link for the given requested URL.
45 std::string GetBlockedURL(const std::string& url);
46
47 // Returns a chrome-unblock://XXX link for the given chrome-block://YYY url.
48 std::string GetUnblockedURL(const std::string& url);
49
50 std::set<std::string> blocked_;
51
52 DISALLOW_COPY_AND_ASSIGN(BlockedResponse);
53 };
54
55 }
28 56
29 #endif // CHROME_BROWSER_PRIVACY_BLACKLIST_BLOCKED_RESPONSE_H_ 57 #endif // CHROME_BROWSER_PRIVACY_BLACKLIST_BLOCKED_RESPONSE_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/privacy_blacklist/blocked_response.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698