summaryrefslogtreecommitdiffstats
path: root/android_webview/native/intercepted_request_data.h
blob: acbe15dad1e353a17ee2ae33d4d322a71c55c8bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CONTENT_BROWSER_ANDROID_INTERCEPTED_REQUEST_DATA_H_
#define CONTENT_BROWSER_ANDROID_INTERCEPTED_REQUEST_DATA_H_

#include <string>

#include "base/android/scoped_java_ref.h"
#include "base/memory/ref_counted.h"

// This class represents the Java-side data that is to be used to complete a
// particular URLRequest.
class InterceptedRequestData {
 public:
  InterceptedRequestData(const base::android::JavaRef<jobject>& obj);
  ~InterceptedRequestData();

  base::android::ScopedJavaLocalRef<jobject> GetInputStream(JNIEnv* env) const;
  bool GetMimeType(JNIEnv* env, std::string* mime_type) const;
  bool GetCharset(JNIEnv* env, std::string* charset) const;

 private:
  base::android::ScopedJavaGlobalRef<jobject> java_object_;

  DISALLOW_COPY_AND_ASSIGN(InterceptedRequestData);
};

bool RegisterInterceptedRequestData(JNIEnv* env);

#endif  // CONTENT_BROWSER_ANDROID_INTERCEPTED_REQUEST_DATA_H_