| 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. This | |
| 21 // class should be copyable. | |
| 22 struct AwWebResourceRequest final { | |
| 23 explicit AwWebResourceRequest(const net::URLRequest& request); | |
| 24 | |
| 25 // Add default copy/move/assign operators. Adding explicit destructor | |
| 26 // prevents generating move operator. | |
| 27 AwWebResourceRequest(AwWebResourceRequest&& other); | |
| 28 AwWebResourceRequest& operator=(AwWebResourceRequest&& other); | |
| 29 ~AwWebResourceRequest(); | |
| 30 | |
| 31 // The java equivalent | |
| 32 struct AwJavaWebResourceRequest { | |
| 33 AwJavaWebResourceRequest(); | |
| 34 ~AwJavaWebResourceRequest(); | |
| 35 | |
| 36 base::android::ScopedJavaLocalRef<jstring> jurl; | |
| 37 base::android::ScopedJavaLocalRef<jstring> jmethod; | |
| 38 base::android::ScopedJavaLocalRef<jobjectArray> jheader_names; | |
| 39 base::android::ScopedJavaLocalRef<jobjectArray> jheader_values; | |
| 40 }; | |
| 41 | |
| 42 // Convenience method to convert AwWebResourceRequest to Java equivalent. | |
| 43 static void ConvertToJava(JNIEnv* env, | |
| 44 const AwWebResourceRequest& request, | |
| 45 AwJavaWebResourceRequest* jRequest); | |
| 46 | |
| 47 std::string url; | |
| 48 std::string method; | |
| 49 bool is_main_frame; | |
| 50 bool has_user_gesture; | |
| 51 std::vector<std::string> header_names; | |
| 52 std::vector<std::string> header_values; | |
| 53 }; | |
| 54 | |
| 55 } // namespace android_webview | |
| 56 | |
| 57 #endif // ANDROID_WEBVIEW_BROWSER_NET_AW_WEB_RESOURCE_REQUEST_H_ | |
| OLD | NEW |