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 #ifndef CHROME_BROWSER_UI_ANDROID_JAVASCRIPT_APP_MODAL_DIALOG_ANDROID_H_ | 5 #ifndef CHROME_BROWSER_UI_ANDROID_JAVASCRIPT_APP_MODAL_DIALOG_ANDROID_H_ |
6 #define CHROME_BROWSER_UI_ANDROID_JAVASCRIPT_APP_MODAL_DIALOG_ANDROID_H_ | 6 #define CHROME_BROWSER_UI_ANDROID_JAVASCRIPT_APP_MODAL_DIALOG_ANDROID_H_ |
7 | 7 |
8 #include "base/android/jni_weak_ref.h" | 8 #include "base/android/jni_weak_ref.h" |
9 #include "base/android/scoped_java_ref.h" | 9 #include "base/android/scoped_java_ref.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "chrome/browser/ui/app_modal_dialogs/native_app_modal_dialog.h" | 11 #include "chrome/browser/ui/app_modal_dialogs/native_app_modal_dialog.h" |
12 | 12 |
13 class JavaScriptAppModalDialog; | 13 class JavaScriptAppModalDialog; |
14 | 14 |
15 class JavascriptAppModalDialogAndroid : public NativeAppModalDialog { | 15 class JavascriptAppModalDialogAndroid : public NativeAppModalDialog { |
16 public: | 16 public: |
17 JavascriptAppModalDialogAndroid(JNIEnv* env, | 17 JavascriptAppModalDialogAndroid(JNIEnv* env, |
18 JavaScriptAppModalDialog* dialog, | 18 JavaScriptAppModalDialog* dialog, |
19 gfx::NativeWindow parent); | 19 gfx::NativeWindow parent); |
20 | 20 |
21 // NativeAppModalDialog: | 21 // NativeAppModalDialog: |
22 virtual int GetAppModalDialogButtons() const OVERRIDE; | 22 virtual int GetAppModalDialogButtons() const override; |
23 virtual void ShowAppModalDialog() OVERRIDE; | 23 virtual void ShowAppModalDialog() override; |
24 virtual void ActivateAppModalDialog() OVERRIDE; | 24 virtual void ActivateAppModalDialog() override; |
25 virtual void CloseAppModalDialog() OVERRIDE; | 25 virtual void CloseAppModalDialog() override; |
26 virtual void AcceptAppModalDialog() OVERRIDE; | 26 virtual void AcceptAppModalDialog() override; |
27 virtual void CancelAppModalDialog() OVERRIDE; | 27 virtual void CancelAppModalDialog() override; |
28 | 28 |
29 // Called when java confirms or cancels the dialog. | 29 // Called when java confirms or cancels the dialog. |
30 void DidAcceptAppModalDialog(JNIEnv* env, | 30 void DidAcceptAppModalDialog(JNIEnv* env, |
31 jobject obj, | 31 jobject obj, |
32 jstring prompt_text, | 32 jstring prompt_text, |
33 bool suppress_js_dialogs); | 33 bool suppress_js_dialogs); |
34 void DidCancelAppModalDialog(JNIEnv* env, jobject, bool suppress_js_dialogs); | 34 void DidCancelAppModalDialog(JNIEnv* env, jobject, bool suppress_js_dialogs); |
35 | 35 |
36 const base::android::ScopedJavaGlobalRef<jobject>& GetDialogObject() const; | 36 const base::android::ScopedJavaGlobalRef<jobject>& GetDialogObject() const; |
37 | 37 |
38 static bool RegisterJavascriptAppModalDialog(JNIEnv* env); | 38 static bool RegisterJavascriptAppModalDialog(JNIEnv* env); |
39 | 39 |
40 private: | 40 private: |
41 // The object deletes itself. | 41 // The object deletes itself. |
42 virtual ~JavascriptAppModalDialogAndroid(); | 42 virtual ~JavascriptAppModalDialogAndroid(); |
43 | 43 |
44 scoped_ptr<JavaScriptAppModalDialog> dialog_; | 44 scoped_ptr<JavaScriptAppModalDialog> dialog_; |
45 base::android::ScopedJavaGlobalRef<jobject> dialog_jobject_; | 45 base::android::ScopedJavaGlobalRef<jobject> dialog_jobject_; |
46 JavaObjectWeakGlobalRef parent_jobject_weak_ref_; | 46 JavaObjectWeakGlobalRef parent_jobject_weak_ref_; |
47 | 47 |
48 DISALLOW_COPY_AND_ASSIGN(JavascriptAppModalDialogAndroid); | 48 DISALLOW_COPY_AND_ASSIGN(JavascriptAppModalDialogAndroid); |
49 }; | 49 }; |
50 | 50 |
51 | 51 |
52 #endif // CHROME_BROWSER_UI_ANDROID_JAVASCRIPT_APP_MODAL_DIALOG_ANDROID_H_ | 52 #endif // CHROME_BROWSER_UI_ANDROID_JAVASCRIPT_APP_MODAL_DIALOG_ANDROID_H_ |
OLD | NEW |