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

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

Issue 226273005: Remove webkit's ResourceLoaderBridge interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: REBASED Created 6 years, 7 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 "content/public/child/request_peer.h" 8 #include "content/public/child/request_peer.h"
9 #include "webkit/common/resource_response_info.h" 9 #include "webkit/common/resource_response_info.h"
10 #include "webkit/common/resource_type.h" 10 #include "webkit/common/resource_type.h"
11 11
12 namespace webkit_glue {
13 class ResourceLoaderBridge;
14 }
15
16 // The SecurityFilterPeer is a proxy to a 12 // The SecurityFilterPeer is a proxy to a
17 // content::RequestPeer instance. It is used to pre-process 13 // content::RequestPeer instance. It is used to pre-process
18 // unsafe resources (such as mixed-content resource). 14 // unsafe resources (such as mixed-content resource).
19 // Call the factory method CreateSecurityFilterPeer() to obtain an instance of 15 // Call the factory method CreateSecurityFilterPeer() to obtain an instance of
20 // SecurityFilterPeer based on the original Peer. 16 // SecurityFilterPeer based on the original Peer.
21 // NOTE: subclasses should insure they delete themselves at the end of the 17 // NOTE: subclasses should insure they delete themselves at the end of the
22 // OnReceiveComplete call. 18 // OnReceiveComplete call.
23 class SecurityFilterPeer : public content::RequestPeer { 19 class SecurityFilterPeer : public content::RequestPeer {
24 public: 20 public:
25 virtual ~SecurityFilterPeer(); 21 virtual ~SecurityFilterPeer();
(...skipping 20 matching lines...) Expand all
46 int data_length, 42 int data_length,
47 int encoded_data_length) OVERRIDE; 43 int encoded_data_length) OVERRIDE;
48 virtual void OnCompletedRequest(int error_code, 44 virtual void OnCompletedRequest(int error_code,
49 bool was_ignored_by_handler, 45 bool was_ignored_by_handler,
50 bool stale_copy_in_cache, 46 bool stale_copy_in_cache,
51 const std::string& security_info, 47 const std::string& security_info,
52 const base::TimeTicks& completion_time, 48 const base::TimeTicks& completion_time,
53 int64 total_transfer_size) OVERRIDE; 49 int64 total_transfer_size) OVERRIDE;
54 50
55 protected: 51 protected:
56 SecurityFilterPeer(webkit_glue::ResourceLoaderBridge* resource_loader_bridge, 52 explicit SecurityFilterPeer(content::RequestPeer* peer);
57 content::RequestPeer* peer);
58 53
59 content::RequestPeer* original_peer_; 54 content::RequestPeer* original_peer_;
60 webkit_glue::ResourceLoaderBridge* resource_loader_bridge_;
61 55
62 private: 56 private:
63 DISALLOW_COPY_AND_ASSIGN(SecurityFilterPeer); 57 DISALLOW_COPY_AND_ASSIGN(SecurityFilterPeer);
64 }; 58 };
65 59
66 // The BufferedPeer reads all the data of the request into an internal buffer. 60 // The BufferedPeer reads all the data of the request into an internal buffer.
67 // Subclasses should implement DataReady() to process the data as necessary. 61 // Subclasses should implement DataReady() to process the data as necessary.
68 class BufferedPeer : public SecurityFilterPeer { 62 class BufferedPeer : public SecurityFilterPeer {
69 public: 63 public:
70 BufferedPeer(webkit_glue::ResourceLoaderBridge* resource_loader_bridge, 64 BufferedPeer(content::RequestPeer* peer, const std::string& mime_type);
71 content::RequestPeer* peer,
72 const std::string& mime_type);
73 virtual ~BufferedPeer(); 65 virtual ~BufferedPeer();
74 66
75 // content::RequestPeer Implementation. 67 // content::RequestPeer Implementation.
76 virtual void OnReceivedResponse( 68 virtual void OnReceivedResponse(
77 const webkit_glue::ResourceResponseInfo& info) OVERRIDE; 69 const webkit_glue::ResourceResponseInfo& info) OVERRIDE;
78 virtual void OnReceivedData(const char* data, 70 virtual void OnReceivedData(const char* data,
79 int data_length, 71 int data_length,
80 int encoded_data_length) OVERRIDE; 72 int encoded_data_length) OVERRIDE;
81 virtual void OnCompletedRequest( 73 virtual void OnCompletedRequest(
82 int error_code, 74 int error_code,
(...skipping 14 matching lines...) Expand all
97 std::string data_; 89 std::string data_;
98 90
99 private: 91 private:
100 std::string mime_type_; 92 std::string mime_type_;
101 93
102 DISALLOW_COPY_AND_ASSIGN(BufferedPeer); 94 DISALLOW_COPY_AND_ASSIGN(BufferedPeer);
103 }; 95 };
104 96
105 // The ReplaceContentPeer cancels the request and serves the provided data as 97 // The ReplaceContentPeer cancels the request and serves the provided data as
106 // content instead. 98 // content instead.
107 // TODO(jcampan): we do not as of now cancel the request, as we do not have 99 // TODO(jcampan): For now the resource is still being fetched, but ignored, as
108 // access to the resource_loader_bridge in the SecurityFilterPeer factory 100 // once we have provided the replacement content, the associated pending request
109 // method. For now the resource is still being fetched, but ignored, as once
110 // we have provided the replacement content, the associated pending request
111 // in ResourceDispatcher is removed and further OnReceived* notifications are 101 // in ResourceDispatcher is removed and further OnReceived* notifications are
112 // ignored. 102 // ignored.
113 class ReplaceContentPeer : public SecurityFilterPeer { 103 class ReplaceContentPeer : public SecurityFilterPeer {
114 public: 104 public:
115 ReplaceContentPeer(webkit_glue::ResourceLoaderBridge* resource_loader_bridge, 105 ReplaceContentPeer(content::RequestPeer* peer,
116 content::RequestPeer* peer,
117 const std::string& mime_type, 106 const std::string& mime_type,
118 const std::string& data); 107 const std::string& data);
119 virtual ~ReplaceContentPeer(); 108 virtual ~ReplaceContentPeer();
120 109
121 // content::RequestPeer Implementation. 110 // content::RequestPeer Implementation.
122 virtual void OnReceivedResponse( 111 virtual void OnReceivedResponse(
123 const webkit_glue::ResourceResponseInfo& info) OVERRIDE; 112 const webkit_glue::ResourceResponseInfo& info) OVERRIDE;
124 virtual void OnReceivedData(const char* data, 113 virtual void OnReceivedData(const char* data,
125 int data_length, 114 int data_length,
126 int encoded_data_length) OVERRIDE; 115 int encoded_data_length) OVERRIDE;
127 virtual void OnCompletedRequest( 116 virtual void OnCompletedRequest(int error_code,
128 int error_code, 117 bool was_ignored_by_handler,
129 bool was_ignored_by_handler, 118 bool stale_copy_in_cache,
130 bool stale_copy_in_cache, 119 const std::string& security_info,
131 const std::string& security_info, 120 const base::TimeTicks& completion_time,
132 const base::TimeTicks& completion_time, 121 int64 total_transfer_size) OVERRIDE;
133 int64 total_transfer_size) OVERRIDE;
134 122
135 private: 123 private:
136 webkit_glue::ResourceResponseInfo response_info_; 124 webkit_glue::ResourceResponseInfo response_info_;
137 std::string mime_type_; 125 std::string mime_type_;
138 std::string data_; 126 std::string data_;
139 127
140 DISALLOW_COPY_AND_ASSIGN(ReplaceContentPeer); 128 DISALLOW_COPY_AND_ASSIGN(ReplaceContentPeer);
141 }; 129 };
142 130
143 #endif // CHROME_RENDERER_SECURITY_FILTER_PEER_H_ 131 #endif // CHROME_RENDERER_SECURITY_FILTER_PEER_H_
OLDNEW
« no previous file with comments | « chrome/renderer/extensions/extension_localization_peer_unittest.cc ('k') | chrome/renderer/security_filter_peer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698