blob: bdaef74f57908bf8c57375b01ac87dd8c83645f9 [file] [log] [blame]
Avi Drissman4e1b7bc32022-09-15 14:03:501// Copyright 2019 The Chromium Authors
Arthur Sonzogni892217ca2019-01-17 10:27:082// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef CONTENT_BROWSER_ANDROID_NAVIGATION_HANDLE_PROXY_H_
6#define CONTENT_BROWSER_ANDROID_NAVIGATION_HANDLE_PROXY_H_
7
8#include "base/android/jni_string.h"
9#include "base/android/scoped_java_ref.h"
Keishi Hattori0e45c022021-11-27 09:25:5210#include "base/memory/raw_ptr.h"
Arthur Sonzogni892217ca2019-01-17 10:27:0811#include "net/http/http_request_headers.h"
12
Arthur Sonzogni892217ca2019-01-17 10:27:0813namespace content {
14
15class NavigationHandle;
16
arthursonzognid95ed0bc2019-02-20 10:36:5217// JNI Bridge in between:
18// - [C++] NavigationHandle
19// - [Java] NavigationHandle
20class NavigationHandleProxy final {
Arthur Sonzogni892217ca2019-01-17 10:27:0821 public:
arthursonzognid95ed0bc2019-02-20 10:36:5222 explicit NavigationHandleProxy(NavigationHandle* cpp_navigation_handle);
23 ~NavigationHandleProxy();
24
Torne (Richard Coles)d07c794b2023-11-21 23:55:4925 const base::android::JavaRef<jobject>& java_navigation_handle() const {
arthursonzognid95ed0bc2019-02-20 10:36:5226 return java_navigation_handle_;
27 }
28
Pete Williamson1d87f4622022-10-18 19:36:4329 // |DidStart|, |DidRedirect| and |DidFinish| update the NavigationHandle on
30 // the java side with the state from the C++ side.
31 void DidStart();
arthursonzognid95ed0bc2019-02-20 10:36:5232 void DidRedirect();
33 void DidFinish();
Arthur Sonzogni892217ca2019-01-17 10:27:0834
Arthur Sonzogni892217ca2019-01-17 10:27:0835 private:
Min Qin9d3dca5c2024-05-10 16:51:5136 std::string GetMimeType() const;
37
arthursonzognid95ed0bc2019-02-20 10:36:5238 base::android::ScopedJavaGlobalRef<jobject> java_navigation_handle_;
Keishi Hattori0e45c022021-11-27 09:25:5239 raw_ptr<NavigationHandle> cpp_navigation_handle_ = nullptr;
Arthur Sonzogni892217ca2019-01-17 10:27:0840};
41
42} // namespace content
43
44#endif // CONTENT_BROWSER_ANDROID_NAVIGATION_HANDLE_PROXY_H_