OLD | NEW |
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 WEBKIT_PLUGINS_NPAPI_PLUGIN_STREAM_URL_H_ | 5 #ifndef WEBKIT_PLUGINS_NPAPI_PLUGIN_STREAM_URL_H_ |
6 #define WEBKIT_PLUGINS_NPAPI_PLUGIN_STREAM_URL_H_ | 6 #define WEBKIT_PLUGINS_NPAPI_PLUGIN_STREAM_URL_H_ |
7 | 7 |
8 #include "webkit/plugins/npapi/plugin_stream.h" | 8 #include "webkit/plugins/npapi/plugin_stream.h" |
9 #include "webkit/plugins/npapi/webplugin.h" | 9 #include "webkit/plugins/npapi/webplugin.h" |
10 #include "googleurl/src/gurl.h" | 10 #include "googleurl/src/gurl.h" |
11 | 11 |
12 namespace webkit { | 12 namespace webkit { |
13 namespace npapi { | 13 namespace npapi { |
14 | 14 |
15 class PluginInstance; | 15 class PluginInstance; |
16 | 16 |
17 // A NPAPI Stream based on a URL. | 17 // A NPAPI Stream based on a URL. |
18 class PluginStreamUrl : public PluginStream, | 18 class PluginStreamUrl : public PluginStream, |
19 public WebPluginResourceClient { | 19 public WebPluginResourceClient { |
20 public: | 20 public: |
21 // Create a new stream for sending to the plugin by fetching | 21 // Create a new stream for sending to the plugin by fetching |
22 // a URL. If notifyNeeded is set, then the plugin will be notified | 22 // a URL. If notifyNeeded is set, then the plugin will be notified |
23 // when the stream has been fully sent to the plugin. Initialize | 23 // when the stream has been fully sent to the plugin. Initialize |
24 // must be called before the object is used. | 24 // must be called before the object is used. |
25 PluginStreamUrl(unsigned long resource_id, | 25 PluginStreamUrl(unsigned long resource_id, |
26 const GURL &url, | 26 const GURL &url, |
27 PluginInstance *instance, | 27 PluginInstance *instance, |
28 bool notify_needed, | 28 bool notify_needed, |
29 void *notify_data); | 29 void *notify_data); |
30 virtual ~PluginStreamUrl(); | |
31 | 30 |
32 // Stop sending the stream to the client. | 31 // Stop sending the stream to the client. |
33 // Overrides the base Close so we can cancel our fetching the URL if | 32 // Overrides the base Close so we can cancel our fetching the URL if |
34 // it is still loading. | 33 // it is still loading. |
35 virtual bool Close(NPReason reason) OVERRIDE; | 34 virtual bool Close(NPReason reason) OVERRIDE; |
36 | |
37 virtual WebPluginResourceClient* AsResourceClient() OVERRIDE; | 35 virtual WebPluginResourceClient* AsResourceClient() OVERRIDE; |
38 | |
39 virtual void CancelRequest() OVERRIDE; | 36 virtual void CancelRequest() OVERRIDE; |
40 | 37 |
41 // | |
42 // WebPluginResourceClient methods | 38 // WebPluginResourceClient methods |
43 // | |
44 virtual void WillSendRequest(const GURL& url, int http_status_code) OVERRIDE; | 39 virtual void WillSendRequest(const GURL& url, int http_status_code) OVERRIDE; |
45 virtual void DidReceiveResponse(const std::string& mime_type, | 40 virtual void DidReceiveResponse(const std::string& mime_type, |
46 const std::string& headers, | 41 const std::string& headers, |
47 uint32 expected_length, | 42 uint32 expected_length, |
48 uint32 last_modified, | 43 uint32 last_modified, |
49 bool request_is_seekable) OVERRIDE; | 44 bool request_is_seekable) OVERRIDE; |
50 virtual void DidReceiveData(const char* buffer, | 45 virtual void DidReceiveData(const char* buffer, |
51 int length, | 46 int length, |
52 int data_offset) OVERRIDE; | 47 int data_offset) OVERRIDE; |
53 virtual void DidFinishLoading() OVERRIDE; | 48 virtual void DidFinishLoading() OVERRIDE; |
54 virtual void DidFail() OVERRIDE; | 49 virtual void DidFail() OVERRIDE; |
55 virtual bool IsMultiByteResponseExpected() OVERRIDE; | 50 virtual bool IsMultiByteResponseExpected() OVERRIDE; |
56 virtual int ResourceId() OVERRIDE; | 51 virtual int ResourceId() OVERRIDE; |
57 | 52 |
| 53 protected: |
| 54 virtual ~PluginStreamUrl(); |
| 55 |
58 private: | 56 private: |
59 GURL url_; | 57 GURL url_; |
60 unsigned long id_; | 58 unsigned long id_; |
61 | 59 |
62 DISALLOW_COPY_AND_ASSIGN(PluginStreamUrl); | 60 DISALLOW_COPY_AND_ASSIGN(PluginStreamUrl); |
63 }; | 61 }; |
64 | 62 |
65 } // namespace npapi | 63 } // namespace npapi |
66 } // namespace webkit | 64 } // namespace webkit |
67 | 65 |
68 #endif // WEBKIT_PLUGINS_NPAPI_PLUGIN_STREAM_URL_H_ | 66 #endif // WEBKIT_PLUGINS_NPAPI_PLUGIN_STREAM_URL_H_ |
OLD | NEW |