Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(29)

Side by Side Diff: android_webview/browser/net/aw_web_resource_response.h

Issue 2889193004: [WebView] Replace AwContentsIoThreadClient, InputStream and AwWebResourceResponse (Closed)
Patch Set: fix test crash Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_BROWSER_NET_AW_WEB_RESOURCE_RESPONSE_H_ 5 #ifndef ANDROID_WEBVIEW_BROWSER_NET_AW_WEB_RESOURCE_RESPONSE_H_
6 #define ANDROID_WEBVIEW_BROWSER_NET_AW_WEB_RESOURCE_RESPONSE_H_ 6 #define ANDROID_WEBVIEW_BROWSER_NET_AW_WEB_RESOURCE_RESPONSE_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 10
11 #include "base/android/jni_android.h" 11 #include "base/android/jni_android.h"
12 #include "base/android/scoped_java_ref.h"
13 #include "base/compiler_specific.h"
12 #include "base/macros.h" 14 #include "base/macros.h"
13 15
14 namespace net { 16 namespace net {
15 class HttpResponseHeaders; 17 class HttpResponseHeaders;
16 class URLRequest; 18 class URLRequest;
17 } 19 }
18 20
19 namespace android_webview { 21 namespace android_webview {
20 22
21 class InputStream; 23 class InputStream;
22 24
23 // This class represents the Java-side data that is to be used to complete a 25 // This class represents the Java-side data that is to be used to complete a
24 // particular URLRequest. 26 // particular URLRequest.
25 class AwWebResourceResponse { 27 class AwWebResourceResponse {
26 public: 28 public:
27 virtual ~AwWebResourceResponse() {} 29 // It is expected that |obj| is an instance of the Java-side
30 // org.chromium.android_webview.AwWebResourceResponse class.
31 AwWebResourceResponse(const base::android::JavaRef<jobject>& obj);
32 ~AwWebResourceResponse();
28 33
29 virtual std::unique_ptr<InputStream> GetInputStream(JNIEnv* env) const = 0; 34 std::unique_ptr<InputStream> GetInputStream(JNIEnv* env) const;
30 virtual bool GetMimeType(JNIEnv* env, std::string* mime_type) const = 0; 35 bool GetMimeType(JNIEnv* env, std::string* mime_type) const;
31 virtual bool GetCharset(JNIEnv* env, std::string* charset) const = 0; 36 bool GetCharset(JNIEnv* env, std::string* charset) const;
32 virtual bool GetStatusInfo(JNIEnv* env, 37 bool GetStatusInfo(JNIEnv* env,
33 int* status_code, 38 int* status_code,
34 std::string* reason_phrase) const = 0; 39 std::string* reason_phrase) const;
35 // If true is returned then |headers| contain the headers, if false is 40 // If true is returned then |headers| contain the headers, if false is
36 // returned |headers| were not updated. 41 // returned |headers| were not updated.
37 virtual bool GetResponseHeaders( 42 bool GetResponseHeaders(JNIEnv* env, net::HttpResponseHeaders* headers) const;
38 JNIEnv* env,
39 net::HttpResponseHeaders* headers) const = 0;
40
41 protected:
42 AwWebResourceResponse() {}
43 43
44 private: 44 private:
45 AwWebResourceResponse();
46
47 base::android::ScopedJavaGlobalRef<jobject> java_object_;
48
45 DISALLOW_COPY_AND_ASSIGN(AwWebResourceResponse); 49 DISALLOW_COPY_AND_ASSIGN(AwWebResourceResponse);
46 }; 50 };
47 51
48 } // namespace android_webview 52 } // namespace android_webview
49 53
50 #endif // ANDROID_WEBVIEW_BROWSER_NET_AW_WEB_RESOURCE_RESPONSE_H_ 54 #endif // ANDROID_WEBVIEW_BROWSER_NET_AW_WEB_RESOURCE_RESPONSE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698