OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_FRAME_NPAPI_URL_REQUEST_H_ |
| 6 #define CHROME_FRAME_NPAPI_URL_REQUEST_H_ |
| 7 |
| 8 #include "base/platform_thread.h" |
| 9 #include "chrome_frame/plugin_url_request.h" |
| 10 #include "third_party/WebKit/WebCore/bridge/npapi.h" |
| 11 |
| 12 class NPAPIUrlRequest : public PluginUrlRequest { |
| 13 public: |
| 14 explicit NPAPIUrlRequest(NPP instance); |
| 15 ~NPAPIUrlRequest(); |
| 16 |
| 17 virtual bool Start(); |
| 18 virtual void Stop(); |
| 19 virtual bool Read(int bytes_to_read); |
| 20 |
| 21 // Called from NPAPI |
| 22 bool OnStreamCreated(const char* mime_type, NPStream* stream); |
| 23 void OnStreamDestroyed(NPReason reason); |
| 24 int OnWriteReady(); |
| 25 int OnWrite(void* buffer, int len); |
| 26 |
| 27 // Thread unsafe implementation of ref counting, since |
| 28 // this will be called on the plugin UI thread only. |
| 29 virtual unsigned long API_CALL AddRef(); |
| 30 virtual unsigned long API_CALL Release(); |
| 31 |
| 32 private: |
| 33 unsigned long ref_count_; |
| 34 NPP instance_; |
| 35 NPStream* stream_; |
| 36 size_t pending_read_size_; |
| 37 URLRequestStatus status_; |
| 38 |
| 39 PlatformThreadId thread_; |
| 40 static int instance_count_; |
| 41 DISALLOW_COPY_AND_ASSIGN(NPAPIUrlRequest); |
| 42 }; |
| 43 |
| 44 #endif // CHROME_FRAME_NPAPI_URL_REQUEST_H_ |
| 45 |
OLD | NEW |