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

Side by Side Diff: chrome/renderer/security_filter_peer.h

Issue 186193005: Move resource_loader_bridge to content/public/child/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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_RENDERER_SECURITY_FILTER_PEER_H_ 5 #ifndef CHROME_RENDERER_SECURITY_FILTER_PEER_H_
6 #define CHROME_RENDERER_SECURITY_FILTER_PEER_H_ 6 #define CHROME_RENDERER_SECURITY_FILTER_PEER_H_
7 7
8 #include "webkit/child/resource_loader_bridge.h" 8 #include "content/public/child/resource_loader_bridge.h"
9 9
10 // The SecurityFilterPeer is a proxy to a 10 // The SecurityFilterPeer is a proxy to a
11 // webkit_glue::ResourceLoaderBridge::Peer instance. It is used to pre-process 11 // content::ResourceLoaderBridge::Peer instance. It is used to pre-process
12 // unsafe resources (such as mixed-content resource). 12 // unsafe resources (such as mixed-content resource).
13 // Call the factory method CreateSecurityFilterPeer() to obtain an instance of 13 // Call the factory method CreateSecurityFilterPeer() to obtain an instance of
14 // SecurityFilterPeer based on the original Peer. 14 // SecurityFilterPeer based on the original Peer.
15 // NOTE: subclasses should insure they delete themselves at the end of the 15 // NOTE: subclasses should insure they delete themselves at the end of the
16 // OnReceiveComplete call. 16 // OnReceiveComplete call.
17 class SecurityFilterPeer : public webkit_glue::ResourceLoaderBridge::Peer { 17 class SecurityFilterPeer : public content::ResourceLoaderBridge::Peer {
18 public: 18 public:
19 virtual ~SecurityFilterPeer(); 19 virtual ~SecurityFilterPeer();
20 20
21 static SecurityFilterPeer* CreateSecurityFilterPeerForDeniedRequest( 21 static SecurityFilterPeer* CreateSecurityFilterPeerForDeniedRequest(
22 ResourceType::Type resource_type, 22 ResourceType::Type resource_type,
23 webkit_glue::ResourceLoaderBridge::Peer* peer, 23 content::ResourceLoaderBridge::Peer* peer,
24 int os_error); 24 int os_error);
25 25
26 static SecurityFilterPeer* CreateSecurityFilterPeerForFrame( 26 static SecurityFilterPeer* CreateSecurityFilterPeerForFrame(
27 webkit_glue::ResourceLoaderBridge::Peer* peer, 27 content::ResourceLoaderBridge::Peer* peer,
28 int os_error); 28 int os_error);
29 29
30 // ResourceLoaderBridge::Peer methods. 30 // ResourceLoaderBridge::Peer methods.
31 virtual void OnUploadProgress(uint64 position, uint64 size) OVERRIDE; 31 virtual void OnUploadProgress(uint64 position, uint64 size) OVERRIDE;
32 virtual bool OnReceivedRedirect( 32 virtual bool OnReceivedRedirect(
33 const GURL& new_url, 33 const GURL& new_url,
34 const webkit_glue::ResourceResponseInfo& info, 34 const webkit_glue::ResourceResponseInfo& info,
35 bool* has_new_first_party_for_cookies, 35 bool* has_new_first_party_for_cookies,
36 GURL* new_first_party_for_cookies) OVERRIDE; 36 GURL* new_first_party_for_cookies) OVERRIDE;
37 virtual void OnReceivedResponse( 37 virtual void OnReceivedResponse(
38 const webkit_glue::ResourceResponseInfo& info) OVERRIDE; 38 const webkit_glue::ResourceResponseInfo& info) OVERRIDE;
39 virtual void OnDownloadedData(int len, int encoded_data_length) OVERRIDE {} 39 virtual void OnDownloadedData(int len, int encoded_data_length) OVERRIDE {}
40 virtual void OnReceivedData(const char* data, 40 virtual void OnReceivedData(const char* data,
41 int data_length, 41 int data_length,
42 int encoded_data_length) OVERRIDE; 42 int encoded_data_length) OVERRIDE;
43 virtual void OnCompletedRequest( 43 virtual void OnCompletedRequest(
44 int error_code, 44 int error_code,
45 bool was_ignored_by_handler, 45 bool was_ignored_by_handler,
46 bool stale_copy_in_cache, 46 bool stale_copy_in_cache,
47 const std::string& security_info, 47 const std::string& security_info,
48 const base::TimeTicks& completion_time, 48 const base::TimeTicks& completion_time,
49 int64 total_transfer_size) OVERRIDE; 49 int64 total_transfer_size) OVERRIDE;
50 50
51 protected: 51 protected:
52 SecurityFilterPeer(webkit_glue::ResourceLoaderBridge* resource_loader_bridge, 52 SecurityFilterPeer(content::ResourceLoaderBridge* resource_loader_bridge,
53 webkit_glue::ResourceLoaderBridge::Peer* peer); 53 content::ResourceLoaderBridge::Peer* peer);
54 54
55 webkit_glue::ResourceLoaderBridge::Peer* original_peer_; 55 content::ResourceLoaderBridge::Peer* original_peer_;
56 webkit_glue::ResourceLoaderBridge* resource_loader_bridge_; 56 content::ResourceLoaderBridge* resource_loader_bridge_;
57 57
58 private: 58 private:
59 DISALLOW_COPY_AND_ASSIGN(SecurityFilterPeer); 59 DISALLOW_COPY_AND_ASSIGN(SecurityFilterPeer);
60 }; 60 };
61 61
62 // The BufferedPeer reads all the data of the request into an internal buffer. 62 // The BufferedPeer reads all the data of the request into an internal buffer.
63 // Subclasses should implement DataReady() to process the data as necessary. 63 // Subclasses should implement DataReady() to process the data as necessary.
64 class BufferedPeer : public SecurityFilterPeer { 64 class BufferedPeer : public SecurityFilterPeer {
65 public: 65 public:
66 BufferedPeer(webkit_glue::ResourceLoaderBridge* resource_loader_bridge, 66 BufferedPeer(content::ResourceLoaderBridge* resource_loader_bridge,
67 webkit_glue::ResourceLoaderBridge::Peer* peer, 67 content::ResourceLoaderBridge::Peer* peer,
68 const std::string& mime_type); 68 const std::string& mime_type);
69 virtual ~BufferedPeer(); 69 virtual ~BufferedPeer();
70 70
71 // ResourceLoaderBridge::Peer Implementation. 71 // ResourceLoaderBridge::Peer Implementation.
72 virtual void OnReceivedResponse( 72 virtual void OnReceivedResponse(
73 const webkit_glue::ResourceResponseInfo& info) OVERRIDE; 73 const webkit_glue::ResourceResponseInfo& info) OVERRIDE;
74 virtual void OnReceivedData(const char* data, 74 virtual void OnReceivedData(const char* data,
75 int data_length, 75 int data_length,
76 int encoded_data_length) OVERRIDE; 76 int encoded_data_length) OVERRIDE;
77 virtual void OnCompletedRequest( 77 virtual void OnCompletedRequest(
(...skipping 23 matching lines...) Expand all
101 // The ReplaceContentPeer cancels the request and serves the provided data as 101 // The ReplaceContentPeer cancels the request and serves the provided data as
102 // content instead. 102 // content instead.
103 // TODO(jcampan): we do not as of now cancel the request, as we do not have 103 // TODO(jcampan): we do not as of now cancel the request, as we do not have
104 // access to the resource_loader_bridge in the SecurityFilterPeer factory 104 // access to the resource_loader_bridge in the SecurityFilterPeer factory
105 // method. For now the resource is still being fetched, but ignored, as once 105 // method. For now the resource is still being fetched, but ignored, as once
106 // we have provided the replacement content, the associated pending request 106 // we have provided the replacement content, the associated pending request
107 // in ResourceDispatcher is removed and further OnReceived* notifications are 107 // in ResourceDispatcher is removed and further OnReceived* notifications are
108 // ignored. 108 // ignored.
109 class ReplaceContentPeer : public SecurityFilterPeer { 109 class ReplaceContentPeer : public SecurityFilterPeer {
110 public: 110 public:
111 ReplaceContentPeer(webkit_glue::ResourceLoaderBridge* resource_loader_bridge, 111 ReplaceContentPeer(content::ResourceLoaderBridge* resource_loader_bridge,
112 webkit_glue::ResourceLoaderBridge::Peer* peer, 112 content::ResourceLoaderBridge::Peer* peer,
113 const std::string& mime_type, 113 const std::string& mime_type,
114 const std::string& data); 114 const std::string& data);
115 virtual ~ReplaceContentPeer(); 115 virtual ~ReplaceContentPeer();
116 116
117 // ResourceLoaderBridge::Peer Implementation. 117 // ResourceLoaderBridge::Peer Implementation.
118 virtual void OnReceivedResponse( 118 virtual void OnReceivedResponse(
119 const webkit_glue::ResourceResponseInfo& info) OVERRIDE; 119 const webkit_glue::ResourceResponseInfo& info) OVERRIDE;
120 virtual void OnReceivedData(const char* data, 120 virtual void OnReceivedData(const char* data,
121 int data_length, 121 int data_length,
122 int encoded_data_length) OVERRIDE; 122 int encoded_data_length) OVERRIDE;
123 virtual void OnCompletedRequest( 123 virtual void OnCompletedRequest(
124 int error_code, 124 int error_code,
125 bool was_ignored_by_handler, 125 bool was_ignored_by_handler,
126 bool stale_copy_in_cache, 126 bool stale_copy_in_cache,
127 const std::string& security_info, 127 const std::string& security_info,
128 const base::TimeTicks& completion_time, 128 const base::TimeTicks& completion_time,
129 int64 total_transfer_size) OVERRIDE; 129 int64 total_transfer_size) OVERRIDE;
130 130
131 private: 131 private:
132 webkit_glue::ResourceResponseInfo response_info_; 132 webkit_glue::ResourceResponseInfo response_info_;
133 std::string mime_type_; 133 std::string mime_type_;
134 std::string data_; 134 std::string data_;
135 135
136 DISALLOW_COPY_AND_ASSIGN(ReplaceContentPeer); 136 DISALLOW_COPY_AND_ASSIGN(ReplaceContentPeer);
137 }; 137 };
138 138
139 #endif // CHROME_RENDERER_SECURITY_FILTER_PEER_H_ 139 #endif // CHROME_RENDERER_SECURITY_FILTER_PEER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698