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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: android_webview/browser/net/aw_web_resource_response.h
diff --git a/android_webview/browser/net/aw_web_resource_response.h b/android_webview/browser/net/aw_web_resource_response.h
index dd2ac1aa1d07f7b6c193ef822bc66fc514fbd67a..e7038bad0b02a636d093589895b7e2b114a29941 100644
--- a/android_webview/browser/net/aw_web_resource_response.h
+++ b/android_webview/browser/net/aw_web_resource_response.h
@@ -9,6 +9,8 @@
#include <string>
#include "base/android/jni_android.h"
+#include "base/android/scoped_java_ref.h"
+#include "base/compiler_specific.h"
#include "base/macros.h"
namespace net {
@@ -24,24 +26,26 @@ class InputStream;
// particular URLRequest.
class AwWebResourceResponse {
public:
- virtual ~AwWebResourceResponse() {}
-
- virtual std::unique_ptr<InputStream> GetInputStream(JNIEnv* env) const = 0;
- virtual bool GetMimeType(JNIEnv* env, std::string* mime_type) const = 0;
- virtual bool GetCharset(JNIEnv* env, std::string* charset) const = 0;
- virtual bool GetStatusInfo(JNIEnv* env,
- int* status_code,
- std::string* reason_phrase) const = 0;
+ // It is expected that |obj| is an instance of the Java-side
+ // org.chromium.android_webview.AwWebResourceResponse class.
+ AwWebResourceResponse(const base::android::JavaRef<jobject>& obj);
+ ~AwWebResourceResponse();
+
+ std::unique_ptr<InputStream> GetInputStream(JNIEnv* env) const;
+ bool GetMimeType(JNIEnv* env, std::string* mime_type) const;
+ bool GetCharset(JNIEnv* env, std::string* charset) const;
+ bool GetStatusInfo(JNIEnv* env,
+ int* status_code,
+ std::string* reason_phrase) const;
// If true is returned then |headers| contain the headers, if false is
// returned |headers| were not updated.
- virtual bool GetResponseHeaders(
- JNIEnv* env,
- net::HttpResponseHeaders* headers) const = 0;
-
- protected:
- AwWebResourceResponse() {}
+ bool GetResponseHeaders(JNIEnv* env, net::HttpResponseHeaders* headers) const;
private:
+ AwWebResourceResponse();
+
+ base::android::ScopedJavaGlobalRef<jobject> java_object_;
+
DISALLOW_COPY_AND_ASSIGN(AwWebResourceResponse);
};

Powered by Google App Engine
This is Rietveld 408576698