OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 ANDROID_WEBVIEW_NATIVE_INPUT_STREAM_H_ | 5 #ifndef ANDROID_WEBVIEW_NATIVE_INPUT_STREAM_H_ |
6 #define ANDROID_WEBVIEW_NATIVE_INPUT_STREAM_H_ | 6 #define ANDROID_WEBVIEW_NATIVE_INPUT_STREAM_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "android_webview/browser/input_stream.h" | 10 #include "android_webview/browser/input_stream.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 | 25 |
26 static const InputStreamImpl* FromInputStream( | 26 static const InputStreamImpl* FromInputStream( |
27 const InputStream* input_stream); | 27 const InputStream* input_stream); |
28 | 28 |
29 // |stream| should be an instance of the InputStream Java class. | 29 // |stream| should be an instance of the InputStream Java class. |
30 // |stream| can't be null. | 30 // |stream| can't be null. |
31 InputStreamImpl(const base::android::JavaRef<jobject>& stream); | 31 InputStreamImpl(const base::android::JavaRef<jobject>& stream); |
32 ~InputStreamImpl() override; | 32 ~InputStreamImpl() override; |
33 | 33 |
34 // Gets the underlying Java object. Guaranteed non-NULL. | 34 // Gets the underlying Java object. Guaranteed non-NULL. |
35 const jobject jobj() const { return jobject_.obj(); } | 35 jobject jobj() const { return jobject_.obj(); } |
36 | 36 |
37 // InputStream implementation. | 37 // InputStream implementation. |
38 bool BytesAvailable(int* bytes_available) const override; | 38 bool BytesAvailable(int* bytes_available) const override; |
39 bool Skip(int64_t n, int64_t* bytes_skipped) override; | 39 bool Skip(int64_t n, int64_t* bytes_skipped) override; |
40 bool Read(net::IOBuffer* dest, int length, int* bytes_read) override; | 40 bool Read(net::IOBuffer* dest, int length, int* bytes_read) override; |
41 | 41 |
42 protected: | 42 protected: |
43 // Parameterless constructor exposed for testing. | 43 // Parameterless constructor exposed for testing. |
44 InputStreamImpl(); | 44 InputStreamImpl(); |
45 | 45 |
46 private: | 46 private: |
47 base::android::ScopedJavaGlobalRef<jobject> jobject_; | 47 base::android::ScopedJavaGlobalRef<jobject> jobject_; |
48 base::android::ScopedJavaGlobalRef<jbyteArray> buffer_; | 48 base::android::ScopedJavaGlobalRef<jbyteArray> buffer_; |
49 | 49 |
50 DISALLOW_COPY_AND_ASSIGN(InputStreamImpl); | 50 DISALLOW_COPY_AND_ASSIGN(InputStreamImpl); |
51 }; | 51 }; |
52 | 52 |
53 bool RegisterInputStream(JNIEnv* env); | 53 bool RegisterInputStream(JNIEnv* env); |
54 | 54 |
55 } // namespace android_webview | 55 } // namespace android_webview |
56 | 56 |
57 #endif // ANDROID_WEBVIEW_NATIVE_INPUT_STREAM_H_ | 57 #endif // ANDROID_WEBVIEW_NATIVE_INPUT_STREAM_H_ |
OLD | NEW |