Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / content / browser / frame_host / navigation_controller_android.h
blob1d9600ed8e737c6d93c26149ac9b077f00a501dc
1 // Copyright 2013 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.
5 #ifndef CONTENT_BROWSER_FRAME_HOST_NAVIGATION_CONTROLLER_ANDROID_H_
6 #define CONTENT_BROWSER_FRAME_HOST_NAVIGATION_CONTROLLER_ANDROID_H_
8 #include <jni.h>
10 #include "base/android/scoped_java_ref.h"
11 #include "base/basictypes.h"
12 #include "base/compiler_specific.h"
13 #include "content/common/content_export.h"
15 namespace content {
17 class NavigationController;
19 // Android wrapper around NavigationController that provides safer passage
20 // from java and back to native and provides java with a means of communicating
21 // with its native counterpart.
22 class CONTENT_EXPORT NavigationControllerAndroid {
23 public:
24 static bool Register(JNIEnv* env);
26 explicit NavigationControllerAndroid(
27 NavigationController* navigation_controller);
28 ~NavigationControllerAndroid();
30 NavigationController* navigation_controller() const {
31 return navigation_controller_;
34 base::android::ScopedJavaLocalRef<jobject> GetJavaObject();
36 jboolean CanGoBack(JNIEnv* env, jobject obj);
37 jboolean CanGoForward(JNIEnv* env, jobject obj);
38 jboolean CanGoToOffset(JNIEnv* env, jobject obj, jint offset);
39 void GoBack(JNIEnv* env, jobject obj);
40 void GoForward(JNIEnv* env, jobject obj);
41 void GoToOffset(JNIEnv* env, jobject obj, jint offset);
42 jboolean IsInitialNavigation(JNIEnv* env, jobject obj);
43 void LoadIfNecessary(JNIEnv* env, jobject obj);
44 void ContinuePendingReload(JNIEnv* env, jobject obj);
45 void Reload(JNIEnv* env, jobject obj, jboolean check_for_repost);
46 void ReloadIgnoringCache(JNIEnv* env, jobject obj, jboolean check_for_repost);
47 void RequestRestoreLoad(JNIEnv* env, jobject obj);
48 void CancelPendingReload(JNIEnv* env, jobject obj);
49 void GoToNavigationIndex(JNIEnv* env, jobject obj, jint index);
50 void LoadUrl(JNIEnv* env,
51 jobject obj,
52 jstring url,
53 jint load_url_type,
54 jint transition_type,
55 jstring j_referrer_url,
56 jint referrer_policy,
57 jint ua_override_option,
58 jstring extra_headers,
59 jbyteArray post_data,
60 jstring base_url_for_data_url,
61 jstring virtual_url_for_data_url,
62 jboolean can_load_local_resources,
63 jboolean is_renderer_initiated,
64 jboolean should_replace_current_entry);
65 void ClearSslPreferences(JNIEnv* env, jobject /* obj */);
66 bool GetUseDesktopUserAgent(JNIEnv* env, jobject /* obj */);
67 void SetUseDesktopUserAgent(JNIEnv* env,
68 jobject /* obj */,
69 jboolean state,
70 jboolean reload_on_state_change);
71 base::android::ScopedJavaLocalRef<jobject> GetEntryAtIndex(JNIEnv* env,
72 jobject obj,
73 int index);
74 base::android::ScopedJavaLocalRef<jobject> GetPendingEntry(JNIEnv* env,
75 jobject /* obj */);
76 int GetNavigationHistory(JNIEnv* env, jobject obj, jobject history);
77 void GetDirectedNavigationHistory(JNIEnv* env,
78 jobject obj,
79 jobject history,
80 jboolean is_forward,
81 jint max_entries);
82 base::android::ScopedJavaLocalRef<jstring>
83 GetOriginalUrlForVisibleNavigationEntry(JNIEnv* env, jobject obj);
84 void ClearHistory(JNIEnv* env, jobject obj);
85 int GetLastCommittedEntryIndex(JNIEnv* env, jobject obj);
86 jboolean RemoveEntryAtIndex(JNIEnv* env, jobject obj, jint index);
87 jboolean CanCopyStateOver(JNIEnv* env, jobject obj);
88 jboolean CanPruneAllButLastCommitted(JNIEnv* env, jobject obj);
89 void CopyStateFrom(JNIEnv* env,
90 jobject obj,
91 jlong source_native_navigation_controller_android);
92 void CopyStateFromAndPrune(JNIEnv* env,
93 jobject obj,
94 jlong source_native_navigation_controller_android,
95 jboolean replace_entry);
97 private:
98 NavigationController* navigation_controller_;
99 base::android::ScopedJavaGlobalRef<jobject> obj_;
101 DISALLOW_COPY_AND_ASSIGN(NavigationControllerAndroid);
104 } // namespace content
106 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_CONTROLLER_ANDROID_H_