| 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 "chrome/browser/ui/android/javascript_app_modal_dialog_android.h" | 5 #include "chrome/browser/ui/android/javascript_app_modal_dialog_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/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 | 10 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 } | 91 } |
| 92 default: | 92 default: |
| 93 NOTREACHED(); | 93 NOTREACHED(); |
| 94 } | 94 } |
| 95 | 95 |
| 96 // Keep a ref to the java side object until we get a confirm or cancel. | 96 // Keep a ref to the java side object until we get a confirm or cancel. |
| 97 dialog_jobject_.Reset(dialog_object); | 97 dialog_jobject_.Reset(dialog_object); |
| 98 | 98 |
| 99 Java_JavascriptAppModalDialog_showJavascriptAppModalDialog(env, | 99 Java_JavascriptAppModalDialog_showJavascriptAppModalDialog(env, |
| 100 dialog_object.obj(), parent_jobj.obj(), | 100 dialog_object.obj(), parent_jobj.obj(), |
| 101 reinterpret_cast<jint>(this)); | 101 reinterpret_cast<intptr_t>(this)); |
| 102 } | 102 } |
| 103 | 103 |
| 104 void JavascriptAppModalDialogAndroid::ActivateAppModalDialog() { | 104 void JavascriptAppModalDialogAndroid::ActivateAppModalDialog() { |
| 105 ShowAppModalDialog(); | 105 ShowAppModalDialog(); |
| 106 } | 106 } |
| 107 | 107 |
| 108 void JavascriptAppModalDialogAndroid::CloseAppModalDialog() { | 108 void JavascriptAppModalDialogAndroid::CloseAppModalDialog() { |
| 109 CancelAppModalDialog(); | 109 CancelAppModalDialog(); |
| 110 } | 110 } |
| 111 | 111 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 } | 156 } |
| 157 | 157 |
| 158 JavascriptAppModalDialogAndroid::~JavascriptAppModalDialogAndroid() { | 158 JavascriptAppModalDialogAndroid::~JavascriptAppModalDialogAndroid() { |
| 159 JNIEnv* env = AttachCurrentThread(); | 159 JNIEnv* env = AttachCurrentThread(); |
| 160 // In case the dialog is still displaying, tell it to close itself. | 160 // In case the dialog is still displaying, tell it to close itself. |
| 161 // This can happen if you trigger a dialog but close the Tab before it's | 161 // This can happen if you trigger a dialog but close the Tab before it's |
| 162 // shown, and then accept the dialog. | 162 // shown, and then accept the dialog. |
| 163 if (!dialog_jobject_.is_null()) | 163 if (!dialog_jobject_.is_null()) |
| 164 Java_JavascriptAppModalDialog_dismiss(env, dialog_jobject_.obj()); | 164 Java_JavascriptAppModalDialog_dismiss(env, dialog_jobject_.obj()); |
| 165 } | 165 } |
| OLD | NEW |