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

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

Issue 501082: Implement delaying resource requests until privacy blacklists are ready. (Closed)
Patch Set: don't get stuck on errors Created 10 years, 11 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_PRIVACY_BLACKLIST_BLOCKED_RESPONSE_H_
6 #define CHROME_BROWSER_PRIVACY_BLACKLIST_BLOCKED_RESPONSE_H_
7
8 #include <string>
9 #include <set>
10
11 #include "chrome/browser/privacy_blacklist/blacklist.h"
12
13 namespace chrome {
14
15 extern const char kUnblockScheme[];
16 extern const char kBlockScheme[];
17
18 // Generate localized responses to replace blacklisted resources.
19 // Blacklisted resources such as frames and iframes are replaced
20 // by HTML. Non visual resources such as Javascript and CSS are
21 // simply be cancelled so there is no blocked response for them.
22
23 class BlockedResponse {
24 public:
25 BlockedResponse() {}
26
27 // Returns the HTML document used as substituted content for blacklisted
28 // elements.
29 std::string GetHTML(const std::string& url, const Blacklist::Match* match);
30
31 // Returns the image (as a string because that is what is expected by callers)
32 // used as substituted content for blacklisted elements.
33 std::string GetImage(const Blacklist::Match* match);
34
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 }
56
57 #endif // CHROME_BROWSER_PRIVACY_BLACKLIST_BLOCKED_RESPONSE_H_
OLDNEW
« no previous file with comments | « chrome/browser/privacy_blacklist/blacklist_ui.cc ('k') | chrome/browser/privacy_blacklist/blocked_response.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698