| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/browser/android/interstitial_page_delegate_android.h" | 5 #include "content/browser/android/interstitial_page_delegate_android.h" |
| 6 | 6 |
| 7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
| 8 #include "base/android/jni_string.h" | 8 #include "base/android/jni_string.h" |
| 9 #include "base/android/scoped_java_ref.h" | 9 #include "base/android/scoped_java_ref.h" |
| 10 #include "content/public/browser/interstitial_page.h" | 10 #include "content/public/browser/interstitial_page.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 page_(NULL) { | 24 page_(NULL) { |
| 25 } | 25 } |
| 26 | 26 |
| 27 InterstitialPageDelegateAndroid::~InterstitialPageDelegateAndroid() { | 27 InterstitialPageDelegateAndroid::~InterstitialPageDelegateAndroid() { |
| 28 JNIEnv* env = AttachCurrentThread(); | 28 JNIEnv* env = AttachCurrentThread(); |
| 29 ScopedJavaLocalRef<jobject> obj = weak_java_obj_.get(env); | 29 ScopedJavaLocalRef<jobject> obj = weak_java_obj_.get(env); |
| 30 if (obj.obj()) | 30 if (obj.obj()) |
| 31 Java_InterstitialPageDelegateAndroid_onNativeDestroyed(env, obj.obj()); | 31 Java_InterstitialPageDelegateAndroid_onNativeDestroyed(env, obj.obj()); |
| 32 } | 32 } |
| 33 | 33 |
| 34 void InterstitialPageDelegateAndroid::Proceed(JNIEnv* env, jobject obj) { | 34 void InterstitialPageDelegateAndroid::Proceed( |
| 35 JNIEnv* env, |
| 36 const JavaParamRef<jobject>& obj) { |
| 35 if (page_) | 37 if (page_) |
| 36 page_->Proceed(); | 38 page_->Proceed(); |
| 37 } | 39 } |
| 38 | 40 |
| 39 void InterstitialPageDelegateAndroid::DontProceed(JNIEnv* env, | 41 void InterstitialPageDelegateAndroid::DontProceed( |
| 40 jobject obj) { | 42 JNIEnv* env, |
| 43 const JavaParamRef<jobject>& obj) { |
| 41 if (page_) | 44 if (page_) |
| 42 page_->DontProceed(); | 45 page_->DontProceed(); |
| 43 } | 46 } |
| 44 | 47 |
| 45 std::string InterstitialPageDelegateAndroid::GetHTMLContents() { | 48 std::string InterstitialPageDelegateAndroid::GetHTMLContents() { |
| 46 return html_content_; | 49 return html_content_; |
| 47 } | 50 } |
| 48 | 51 |
| 49 void InterstitialPageDelegateAndroid::OnProceed() { | 52 void InterstitialPageDelegateAndroid::OnProceed() { |
| 50 JNIEnv* env = AttachCurrentThread(); | 53 JNIEnv* env = AttachCurrentThread(); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 static jlong Init(JNIEnv* env, | 90 static jlong Init(JNIEnv* env, |
| 88 const JavaParamRef<jobject>& obj, | 91 const JavaParamRef<jobject>& obj, |
| 89 const JavaParamRef<jstring>& html_content) { | 92 const JavaParamRef<jstring>& html_content) { |
| 90 InterstitialPageDelegateAndroid* delegate = | 93 InterstitialPageDelegateAndroid* delegate = |
| 91 new InterstitialPageDelegateAndroid( | 94 new InterstitialPageDelegateAndroid( |
| 92 env, obj, base::android::ConvertJavaStringToUTF8(env, html_content)); | 95 env, obj, base::android::ConvertJavaStringToUTF8(env, html_content)); |
| 93 return reinterpret_cast<intptr_t>(delegate); | 96 return reinterpret_cast<intptr_t>(delegate); |
| 94 } | 97 } |
| 95 | 98 |
| 96 } // namespace content | 99 } // namespace content |
| OLD | NEW |