OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 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 ANDROID_WEBVIEW_BROWSER_NET_AW_WEB_RESOURCE_REQUEST_H_ |
| 6 #define ANDROID_WEBVIEW_BROWSER_NET_AW_WEB_RESOURCE_REQUEST_H_ |
| 7 |
| 8 #include <string> |
| 9 #include <vector> |
| 10 |
| 11 #include "base/android/jni_array.h" |
| 12 #include "base/android/jni_string.h" |
| 13 |
| 14 namespace net { |
| 15 class URLRequest; |
| 16 } |
| 17 |
| 18 namespace android_webview { |
| 19 |
| 20 // A passive data structure only used to carry request information. |
| 21 struct AwWebResourceRequest { |
| 22 explicit AwWebResourceRequest(const net::URLRequest& request); |
| 23 virtual ~AwWebResourceRequest() {} |
| 24 |
| 25 // The java equivalent |
| 26 struct AwJavaWebResourceRequest { |
| 27 base::android::ScopedJavaLocalRef<jstring> jurl; |
| 28 base::android::ScopedJavaLocalRef<jstring> jmethod; |
| 29 base::android::ScopedJavaLocalRef<jobjectArray> jheader_names; |
| 30 base::android::ScopedJavaLocalRef<jobjectArray> jheader_values; |
| 31 }; |
| 32 |
| 33 // Convenience method to convert AwWebResourceRequest to Java equivalent. |
| 34 static void ConvertToJava(JNIEnv* env, |
| 35 const AwWebResourceRequest& request, |
| 36 AwJavaWebResourceRequest* jRequest); |
| 37 |
| 38 std::string url; |
| 39 std::string method; |
| 40 bool is_main_frame; |
| 41 bool has_user_gesture; |
| 42 std::vector<std::string> header_names; |
| 43 std::vector<std::string> header_values; |
| 44 }; |
| 45 |
| 46 } // namespace android_webview |
| 47 |
| 48 #endif // ANDROID_WEBVIEW_BROWSER_NET_AW_WEB_RESOURCE_REQUEST_H_ |
OLD | NEW |