Move about://-related constants from //content to //url
[chromium-blink-merge.git] / content / browser / frame_host / navigation_controller_android.cc
blob536e17dd3ec2d4c1c421529f2f3265422ef90dd6
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 #include "content/browser/frame_host/navigation_controller_android.h"
7 #include "base/android/jni_android.h"
8 #include "content/public/browser/navigation_controller.h"
9 #include "jni/NavigationControllerImpl_jni.h"
11 using base::android::AttachCurrentThread;
13 namespace content {
15 // static
16 bool NavigationControllerAndroid::Register(JNIEnv* env) {
17 return RegisterNativesImpl(env);
20 NavigationControllerAndroid::NavigationControllerAndroid(
21 NavigationController* navigation_controller)
22 : navigation_controller_(navigation_controller) {
23 JNIEnv* env = AttachCurrentThread();
24 obj_.Reset(env,
25 Java_NavigationControllerImpl_create(
26 env, reinterpret_cast<intptr_t>(this)).obj());
29 NavigationControllerAndroid::~NavigationControllerAndroid() {
30 Java_NavigationControllerImpl_destroy(AttachCurrentThread(), obj_.obj());
33 base::android::ScopedJavaLocalRef<jobject>
34 NavigationControllerAndroid::GetJavaObject() {
35 return base::android::ScopedJavaLocalRef<jobject>(obj_);
38 jboolean NavigationControllerAndroid::CanGoBack(JNIEnv* env, jobject obj) {
39 return navigation_controller_->CanGoBack();
42 jboolean NavigationControllerAndroid::CanGoForward(JNIEnv* env,
43 jobject obj) {
44 return navigation_controller_->CanGoForward();
47 jboolean NavigationControllerAndroid::CanGoToOffset(JNIEnv* env,
48 jobject obj,
49 jint offset) {
50 return navigation_controller_->CanGoToOffset(offset);
53 void NavigationControllerAndroid::GoBack(JNIEnv* env, jobject obj) {
54 navigation_controller_->GoBack();
57 void NavigationControllerAndroid::GoForward(JNIEnv* env, jobject obj) {
58 navigation_controller_->GoForward();
61 void NavigationControllerAndroid::GoToOffset(JNIEnv* env,
62 jobject obj,
63 jint offset) {
64 navigation_controller_->GoToOffset(offset);
67 void NavigationControllerAndroid::GoToNavigationIndex(JNIEnv* env,
68 jobject obj,
69 jint index) {
70 navigation_controller_->GoToIndex(index);
73 } // namespace content