Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / xwalk / runtime / browser / android / intercepted_request_data_impl.h
1 // Copyright (c) 2012 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 XWALK_RUNTIME_BROWSER_ANDROID_INTERCEPTED_REQUEST_DATA_IMPL_H_
6 #define XWALK_RUNTIME_BROWSER_ANDROID_INTERCEPTED_REQUEST_DATA_IMPL_H_
7
8 #include "xwalk/runtime/browser/android/intercepted_request_data.h"
9
10 #include <string>
11
12 #include "base/android/scoped_java_ref.h"
13 #include "base/compiler_specific.h"
14 #include "base/memory/scoped_ptr.h"
15
16 namespace xwalk {
17
18 class InputStream;
19
20 class InterceptedRequestDataImpl : public InterceptedRequestData {
21  public:
22   explicit InterceptedRequestDataImpl(
23       const base::android::JavaRef<jobject>& obj);
24   virtual ~InterceptedRequestDataImpl();
25
26   virtual scoped_ptr<InputStream> GetInputStream(JNIEnv* env) const;
27   virtual bool GetMimeType(JNIEnv* env, std::string* mime_type) const;
28   virtual bool GetCharset(JNIEnv* env, std::string* charset) const;
29   virtual bool GetPackageName(JNIEnv* env, std::string* name) const;
30
31   net::URLRequestJob* CreateJobFor(
32       net::URLRequest* request,
33       net::NetworkDelegate* network_delegate) const override;
34
35  private:
36   base::android::ScopedJavaGlobalRef<jobject> java_object_;
37
38   DISALLOW_COPY_AND_ASSIGN(InterceptedRequestDataImpl);
39 };
40
41 bool RegisterInterceptedRequestData(JNIEnv* env);
42
43 }  // namespace xwalk
44
45 #endif  // XWALK_RUNTIME_BROWSER_ANDROID_INTERCEPTED_REQUEST_DATA_IMPL_H_