OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_GLUE_PLUGIN_PLUGIN_STREAM_URL_H__ | 5 #ifndef WEBKIT_PLUGINS_NPAPI_PLUGIN_STREAM_URL_H_ |
6 #define WEBKIT_GLUE_PLUGIN_PLUGIN_STREAM_URL_H__ | 6 #define WEBKIT_PLUGINS_NPAPI_PLUGIN_STREAM_URL_H_ |
7 | 7 |
8 | 8 #include "webkit/plugins/npapi/plugin_stream.h" |
9 #include "webkit/glue/plugins/plugin_stream.h" | 9 #include "webkit/plugins/npapi/webplugin.h" |
10 #include "webkit/glue/plugins/webplugin.h" | |
11 #include "googleurl/src/gurl.h" | 10 #include "googleurl/src/gurl.h" |
12 | 11 |
13 namespace NPAPI { | 12 namespace webkit { |
| 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 webkit_glue::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(); | 30 virtual ~PluginStreamUrl(); |
31 | 31 |
32 // Stop sending the stream to the client. | 32 // Stop sending the stream to the client. |
33 // Overrides the base Close so we can cancel our fetching the URL if | 33 // Overrides the base Close so we can cancel our fetching the URL if |
34 // it is still loading. | 34 // it is still loading. |
35 virtual bool Close(NPReason reason); | 35 virtual bool Close(NPReason reason); |
36 | 36 |
37 virtual webkit_glue::WebPluginResourceClient* AsResourceClient(); | 37 virtual WebPluginResourceClient* AsResourceClient(); |
38 | 38 |
39 virtual void CancelRequest(); | 39 virtual void CancelRequest(); |
40 | 40 |
41 // | 41 // |
42 // WebPluginResourceClient methods | 42 // WebPluginResourceClient methods |
43 // | 43 // |
44 virtual void WillSendRequest(const GURL& url, int http_status_code); | 44 virtual void WillSendRequest(const GURL& url, int http_status_code); |
45 virtual void DidReceiveResponse(const std::string& mime_type, | 45 virtual void DidReceiveResponse(const std::string& mime_type, |
46 const std::string& headers, | 46 const std::string& headers, |
47 uint32 expected_length, | 47 uint32 expected_length, |
48 uint32 last_modified, | 48 uint32 last_modified, |
49 bool request_is_seekable); | 49 bool request_is_seekable); |
50 virtual void DidReceiveData(const char* buffer, int length, int data_offset); | 50 virtual void DidReceiveData(const char* buffer, int length, int data_offset); |
51 virtual void DidFinishLoading(); | 51 virtual void DidFinishLoading(); |
52 virtual void DidFail(); | 52 virtual void DidFail(); |
53 virtual bool IsMultiByteResponseExpected(); | 53 virtual bool IsMultiByteResponseExpected(); |
54 virtual int ResourceId(); | 54 virtual int ResourceId(); |
55 | 55 |
56 private: | 56 private: |
57 GURL url_; | 57 GURL url_; |
58 unsigned long id_; | 58 unsigned long id_; |
59 | 59 |
60 DISALLOW_COPY_AND_ASSIGN(PluginStreamUrl); | 60 DISALLOW_COPY_AND_ASSIGN(PluginStreamUrl); |
61 }; | 61 }; |
62 | 62 |
63 } // namespace NPAPI | 63 } // namespace npapi |
| 64 } // namespace webkit |
64 | 65 |
65 #endif // WEBKIT_GLUE_PLUGIN_PLUGIN_STREAM_URL_H__ | 66 #endif // WEBKIT_PLUGINS_NPAPI_PLUGIN_STREAM_URL_H_ |
OLD | NEW |