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

Side by Side Diff: content/renderer/pepper/pepper_url_loader_host.h

Issue 63253002: Rename WebKit namespace to blink (part 3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 CONTENT_RENDERER_PEPPER_PEPPER_URL_LOADER_HOST_H_ 5 #ifndef CONTENT_RENDERER_PEPPER_PEPPER_URL_LOADER_HOST_H_
6 #define CONTENT_RENDERER_PEPPER_PEPPER_URL_LOADER_HOST_H_ 6 #define CONTENT_RENDERER_PEPPER_PEPPER_URL_LOADER_HOST_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/memory/scoped_vector.h" 10 #include "base/memory/scoped_vector.h"
11 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
12 #include "content/common/content_export.h" 12 #include "content/common/content_export.h"
13 #include "ppapi/host/resource_host.h" 13 #include "ppapi/host/resource_host.h"
14 #include "ppapi/proxy/resource_message_params.h" 14 #include "ppapi/proxy/resource_message_params.h"
15 #include "ppapi/shared_impl/url_request_info_data.h" 15 #include "ppapi/shared_impl/url_request_info_data.h"
16 #include "ppapi/shared_impl/url_response_info_data.h" 16 #include "ppapi/shared_impl/url_response_info_data.h"
17 #include "third_party/WebKit/public/platform/WebURLLoaderClient.h" 17 #include "third_party/WebKit/public/platform/WebURLLoaderClient.h"
18 18
19 namespace WebKit { 19 namespace blink {
20 class WebFrame; 20 class WebFrame;
21 class WebURLLoader; 21 class WebURLLoader;
22 } 22 }
23 23
24 namespace content { 24 namespace content {
25 25
26 class RendererPpapiHostImpl; 26 class RendererPpapiHostImpl;
27 27
28 class PepperURLLoaderHost 28 class PepperURLLoaderHost
29 : public ppapi::host::ResourceHost, 29 : public ppapi::host::ResourceHost,
30 public WebKit::WebURLLoaderClient { 30 public blink::WebURLLoaderClient {
31 public: 31 public:
32 // If main_document_loader is true, PP_Resource must be 0 since it will be 32 // If main_document_loader is true, PP_Resource must be 0 since it will be
33 // pending until the plugin resource attaches to it. 33 // pending until the plugin resource attaches to it.
34 PepperURLLoaderHost(RendererPpapiHostImpl* host, 34 PepperURLLoaderHost(RendererPpapiHostImpl* host,
35 bool main_document_loader, 35 bool main_document_loader,
36 PP_Instance instance, 36 PP_Instance instance,
37 PP_Resource resource); 37 PP_Resource resource);
38 virtual ~PepperURLLoaderHost(); 38 virtual ~PepperURLLoaderHost();
39 39
40 // ResourceHost implementation. 40 // ResourceHost implementation.
41 virtual int32_t OnResourceMessageReceived( 41 virtual int32_t OnResourceMessageReceived(
42 const IPC::Message& msg, 42 const IPC::Message& msg,
43 ppapi::host::HostMessageContext* context) OVERRIDE; 43 ppapi::host::HostMessageContext* context) OVERRIDE;
44 44
45 // WebKit::WebURLLoaderClient implementation. 45 // blink::WebURLLoaderClient implementation.
46 virtual void willSendRequest(WebKit::WebURLLoader* loader, 46 virtual void willSendRequest(blink::WebURLLoader* loader,
47 WebKit::WebURLRequest& new_request, 47 blink::WebURLRequest& new_request,
48 const WebKit::WebURLResponse& redir_response); 48 const blink::WebURLResponse& redir_response);
49 virtual void didSendData(WebKit::WebURLLoader* loader, 49 virtual void didSendData(blink::WebURLLoader* loader,
50 unsigned long long bytes_sent, 50 unsigned long long bytes_sent,
51 unsigned long long total_bytes_to_be_sent); 51 unsigned long long total_bytes_to_be_sent);
52 virtual void didReceiveResponse(WebKit::WebURLLoader* loader, 52 virtual void didReceiveResponse(blink::WebURLLoader* loader,
53 const WebKit::WebURLResponse& response); 53 const blink::WebURLResponse& response);
54 virtual void didDownloadData(WebKit::WebURLLoader* loader, 54 virtual void didDownloadData(blink::WebURLLoader* loader,
55 int data_length, 55 int data_length,
56 int encoded_data_length); 56 int encoded_data_length);
57 virtual void didReceiveData(WebKit::WebURLLoader* loader, 57 virtual void didReceiveData(blink::WebURLLoader* loader,
58 const char* data, 58 const char* data,
59 int data_length, 59 int data_length,
60 int encoded_data_length); 60 int encoded_data_length);
61 virtual void didFinishLoading(WebKit::WebURLLoader* loader, 61 virtual void didFinishLoading(blink::WebURLLoader* loader,
62 double finish_time); 62 double finish_time);
63 virtual void didFail(WebKit::WebURLLoader* loader, 63 virtual void didFail(blink::WebURLLoader* loader,
64 const WebKit::WebURLError& error); 64 const blink::WebURLError& error);
65 65
66 private: 66 private:
67 // ResourceHost protected overrides. 67 // ResourceHost protected overrides.
68 virtual void DidConnectPendingHostToResource() OVERRIDE; 68 virtual void DidConnectPendingHostToResource() OVERRIDE;
69 69
70 // IPC messages 70 // IPC messages
71 int32_t OnHostMsgOpen(ppapi::host::HostMessageContext* context, 71 int32_t OnHostMsgOpen(ppapi::host::HostMessageContext* context,
72 const ppapi::URLRequestInfoData& request_data); 72 const ppapi::URLRequestInfoData& request_data);
73 int32_t InternalOnHostMsgOpen(ppapi::host::HostMessageContext* context, 73 int32_t InternalOnHostMsgOpen(ppapi::host::HostMessageContext* context,
74 const ppapi::URLRequestInfoData& request_data); 74 const ppapi::URLRequestInfoData& request_data);
(...skipping 14 matching lines...) Expand all
89 // Sends or queues an unsolicited message to the plugin resource. This is 89 // Sends or queues an unsolicited message to the plugin resource. This is
90 // used inside SendUpdateToPlugin for messages that are already ordered 90 // used inside SendUpdateToPlugin for messages that are already ordered
91 // properly. 91 // properly.
92 // 92 //
93 // Takes ownership of the given pointer. 93 // Takes ownership of the given pointer.
94 void SendOrderedUpdateToPlugin(IPC::Message* msg); 94 void SendOrderedUpdateToPlugin(IPC::Message* msg);
95 95
96 void Close(); 96 void Close();
97 97
98 // Returns the frame for the current request. 98 // Returns the frame for the current request.
99 WebKit::WebFrame* GetFrame(); 99 blink::WebFrame* GetFrame();
100 100
101 // Calls SetDefersLoading on the current load. This encapsulates the logic 101 // Calls SetDefersLoading on the current load. This encapsulates the logic
102 // differences between document loads and regular ones. 102 // differences between document loads and regular ones.
103 void SetDefersLoading(bool defers_loading); 103 void SetDefersLoading(bool defers_loading);
104 104
105 // Converts a WebURLResponse to a URLResponseInfo and saves it. 105 // Converts a WebURLResponse to a URLResponseInfo and saves it.
106 void SaveResponse(const WebKit::WebURLResponse& response); 106 void SaveResponse(const blink::WebURLResponse& response);
107 void DidDataFromWebURLResponse(const ppapi::URLResponseInfoData& data); 107 void DidDataFromWebURLResponse(const ppapi::URLResponseInfoData& data);
108 108
109 // Sends the UpdateProgress message (if necessary) to the plugin. 109 // Sends the UpdateProgress message (if necessary) to the plugin.
110 void UpdateProgress(); 110 void UpdateProgress();
111 111
112 // Non-owning pointer. 112 // Non-owning pointer.
113 RendererPpapiHostImpl* renderer_ppapi_host_; 113 RendererPpapiHostImpl* renderer_ppapi_host_;
114 114
115 // If true, then the plugin instance is a full-frame plugin and we're just 115 // If true, then the plugin instance is a full-frame plugin and we're just
116 // wrapping the main document's loader (i.e. loader_ is null). 116 // wrapping the main document's loader (i.e. loader_ is null).
117 bool main_document_loader_; 117 bool main_document_loader_;
118 118
119 // The data that generated the request. 119 // The data that generated the request.
120 ppapi::URLRequestInfoData request_data_; 120 ppapi::URLRequestInfoData request_data_;
121 121
122 // Set to true when this loader can ignore same originl policy. 122 // Set to true when this loader can ignore same originl policy.
123 bool has_universal_access_; 123 bool has_universal_access_;
124 124
125 // The loader associated with this request. MAY BE NULL. 125 // The loader associated with this request. MAY BE NULL.
126 // 126 //
127 // This will be NULL if the load hasn't been opened yet, or if this is a main 127 // This will be NULL if the load hasn't been opened yet, or if this is a main
128 // document loader (when registered as a mime type). Therefore, you should 128 // document loader (when registered as a mime type). Therefore, you should
129 // always NULL check this value before using it. In the case of a main 129 // always NULL check this value before using it. In the case of a main
130 // document load, you would call the functions on the document to cancel the 130 // document load, you would call the functions on the document to cancel the
131 // load, etc. since there is no loader. 131 // load, etc. since there is no loader.
132 scoped_ptr<WebKit::WebURLLoader> loader_; 132 scoped_ptr<blink::WebURLLoader> loader_;
133 133
134 int64_t bytes_sent_; 134 int64_t bytes_sent_;
135 int64_t total_bytes_to_be_sent_; 135 int64_t total_bytes_to_be_sent_;
136 int64_t bytes_received_; 136 int64_t bytes_received_;
137 int64_t total_bytes_to_be_received_; 137 int64_t total_bytes_to_be_received_;
138 138
139 // Messages sent while the resource host is pending. These will be forwarded 139 // Messages sent while the resource host is pending. These will be forwarded
140 // to the plugin when the plugin side connects. The pointers are owned by 140 // to the plugin when the plugin side connects. The pointers are owned by
141 // this object and must be deleted. 141 // this object and must be deleted.
142 ScopedVector<IPC::Message> pending_replies_; 142 ScopedVector<IPC::Message> pending_replies_;
143 ScopedVector<IPC::Message> out_of_order_replies_; 143 ScopedVector<IPC::Message> out_of_order_replies_;
144 144
145 // True when there's a pending DataFromURLResponse call which will send a 145 // True when there's a pending DataFromURLResponse call which will send a
146 // PpapiPluginMsg_URLLoader_ReceivedResponse to the plugin, which introduces 146 // PpapiPluginMsg_URLLoader_ReceivedResponse to the plugin, which introduces
147 // ordering constraints on following messages to the plugin. 147 // ordering constraints on following messages to the plugin.
148 bool pending_response_; 148 bool pending_response_;
149 149
150 base::WeakPtrFactory<PepperURLLoaderHost> weak_factory_; 150 base::WeakPtrFactory<PepperURLLoaderHost> weak_factory_;
151 151
152 DISALLOW_COPY_AND_ASSIGN(PepperURLLoaderHost); 152 DISALLOW_COPY_AND_ASSIGN(PepperURLLoaderHost);
153 }; 153 };
154 154
155 } // namespace content 155 } // namespace content
156 156
157 #endif // CONTENT_RENDERER_PEPPER_PEPPER_URL_LOADER_HOST_H_ 157 #endif // CONTENT_RENDERER_PEPPER_PEPPER_URL_LOADER_HOST_H_
OLDNEW
« no previous file with comments | « content/renderer/pepper/pepper_plugin_instance_impl.cc ('k') | content/renderer/pepper/pepper_url_loader_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698