diff options
author | mkosiba@chromium.org <mkosiba@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-13 10:34:44 +0000 |
---|---|---|
committer | mkosiba@chromium.org <mkosiba@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-13 10:34:44 +0000 |
commit | b4939dfd2e2e14d185873be14dedfbb709d7a9c4 (patch) | |
tree | a2772fd23594426e3038afc7c1ee0d05aec5fc91 /android_webview/native | |
parent | 91f0755c0f15ae1f49dc2d38309f9c5882945a18 (diff) | |
download | chromium_src-b4939dfd2e2e14d185873be14dedfbb709d7a9c4.zip chromium_src-b4939dfd2e2e14d185873be14dedfbb709d7a9c4.tar.gz chromium_src-b4939dfd2e2e14d185873be14dedfbb709d7a9c4.tar.bz2 |
[android_webview] InterceptedRequestData refactoring.
Moving the OpenInputStream, GetMimeType and GetCharset methods to the
InterceptedRequestData class from InterceptedRequestDataImpl makes the
CreateJobFor method slightly cleaner.
BUG=None
TEST=AndroidWebViewTest
Android-only change, trybots happy
NOTRY=true
Review URL: https://codereview.chromium.org/65043005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@234796 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'android_webview/native')
-rw-r--r-- | android_webview/native/intercepted_request_data_impl.cc | 63 | ||||
-rw-r--r-- | android_webview/native/intercepted_request_data_impl.h | 6 |
2 files changed, 3 insertions, 66 deletions
diff --git a/android_webview/native/intercepted_request_data_impl.cc b/android_webview/native/intercepted_request_data_impl.cc index 03b9f42..8b583df 100644 --- a/android_webview/native/intercepted_request_data_impl.cc +++ b/android_webview/native/intercepted_request_data_impl.cc @@ -4,7 +4,6 @@ #include "android_webview/native/intercepted_request_data_impl.h" -#include "android_webview/browser/net/android_stream_reader_url_request_job.h" #include "android_webview/native/input_stream_impl.h" #include "base/android/jni_android.h" #include "base/android/jni_string.h" @@ -16,68 +15,6 @@ using base::android::ScopedJavaLocalRef; namespace android_webview { -namespace { - -class StreamReaderJobDelegateImpl : - public AndroidStreamReaderURLRequestJob::Delegate { - public: - StreamReaderJobDelegateImpl( - scoped_ptr<InterceptedRequestDataImpl> intercepted_request_data) - : intercepted_request_data_impl_(intercepted_request_data.Pass()) { - DCHECK(intercepted_request_data_impl_); - } - - virtual scoped_ptr<InputStream> OpenInputStream( - JNIEnv* env, - const GURL& url) OVERRIDE { - return intercepted_request_data_impl_->GetInputStream(env).Pass(); - } - - virtual void OnInputStreamOpenFailed(net::URLRequest* request, - bool* restart) OVERRIDE { - *restart = false; - } - - virtual bool GetMimeType(JNIEnv* env, - net::URLRequest* request, - android_webview::InputStream* stream, - std::string* mime_type) OVERRIDE { - return intercepted_request_data_impl_->GetMimeType(env, mime_type); - } - - virtual bool GetCharset(JNIEnv* env, - net::URLRequest* request, - android_webview::InputStream* stream, - std::string* charset) OVERRIDE { - return intercepted_request_data_impl_->GetCharset(env, charset); - } - - private: - scoped_ptr<InterceptedRequestDataImpl> intercepted_request_data_impl_; -}; - -} // namespace - -// static -net::URLRequestJob* InterceptedRequestData::CreateJobFor( - scoped_ptr<InterceptedRequestData> intercepted_request_data, - net::URLRequest* request, - net::NetworkDelegate* network_delegate) { - DCHECK(intercepted_request_data); - DCHECK(request); - DCHECK(network_delegate); - - return new AndroidStreamReaderURLRequestJob( - request, - network_delegate, - scoped_ptr<AndroidStreamReaderURLRequestJob::Delegate>( - new StreamReaderJobDelegateImpl( - // PassAs rightfully doesn't support downcasts. - scoped_ptr<InterceptedRequestDataImpl>( - static_cast<InterceptedRequestDataImpl*>( - intercepted_request_data.release()))))); -} - InterceptedRequestDataImpl::InterceptedRequestDataImpl( const base::android::JavaRef<jobject>& obj) : java_object_(obj) { diff --git a/android_webview/native/intercepted_request_data_impl.h b/android_webview/native/intercepted_request_data_impl.h index 0246569..598b319 100644 --- a/android_webview/native/intercepted_request_data_impl.h +++ b/android_webview/native/intercepted_request_data_impl.h @@ -21,9 +21,9 @@ class InterceptedRequestDataImpl : public InterceptedRequestData { InterceptedRequestDataImpl(const base::android::JavaRef<jobject>& obj); virtual ~InterceptedRequestDataImpl(); - virtual scoped_ptr<InputStream> GetInputStream(JNIEnv* env) const; - virtual bool GetMimeType(JNIEnv* env, std::string* mime_type) const; - virtual bool GetCharset(JNIEnv* env, std::string* charset) const; + virtual scoped_ptr<InputStream> GetInputStream(JNIEnv* env) const OVERRIDE; + virtual bool GetMimeType(JNIEnv* env, std::string* mime_type) const OVERRIDE; + virtual bool GetCharset(JNIEnv* env, std::string* charset) const OVERRIDE; private: base::android::ScopedJavaGlobalRef<jobject> java_object_; |