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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_ANDROID_JAVASCRIPT_APP_MODAL_DIALOG_ANDROID_H_
6 #define CHROME_BROWSER_UI_ANDROID_JAVASCRIPT_APP_MODAL_DIALOG_ANDROID_H_
8 #include "base/android/jni_helper.h"
9 #include "base/android/scoped_java_ref.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "chrome/browser/ui/app_modal_dialogs/native_app_modal_dialog.h"
13 class JavaScriptAppModalDialog
;
15 class JavascriptAppModalDialogAndroid
: public NativeAppModalDialog
{
17 JavascriptAppModalDialogAndroid(JNIEnv
* env
,
18 JavaScriptAppModalDialog
* dialog
,
19 gfx::NativeWindow parent
);
21 // NativeAppModalDialog:
22 virtual int GetAppModalDialogButtons() const OVERRIDE
;
23 virtual void ShowAppModalDialog() OVERRIDE
;
24 virtual void ActivateAppModalDialog() OVERRIDE
;
25 virtual void CloseAppModalDialog() OVERRIDE
;
26 virtual void AcceptAppModalDialog() OVERRIDE
;
27 virtual void CancelAppModalDialog() OVERRIDE
;
29 // Called when java confirms or cancels the dialog.
30 void DidAcceptAppModalDialog(JNIEnv
* env
,
33 bool suppress_js_dialogs
);
34 void DidCancelAppModalDialog(JNIEnv
* env
, jobject
, bool suppress_js_dialogs
);
36 const base::android::ScopedJavaGlobalRef
<jobject
>& GetDialogObject() const;
38 static bool RegisterJavascriptAppModalDialog(JNIEnv
* env
);
41 // The object deletes itself.
42 virtual ~JavascriptAppModalDialogAndroid();
44 scoped_ptr
<JavaScriptAppModalDialog
> dialog_
;
45 base::android::ScopedJavaGlobalRef
<jobject
> dialog_jobject_
;
46 JavaObjectWeakGlobalRef parent_jobject_weak_ref_
;
48 DISALLOW_COPY_AND_ASSIGN(JavascriptAppModalDialogAndroid
);
52 #endif // CHROME_BROWSER_UI_ANDROID_JAVASCRIPT_APP_MODAL_DIALOG_ANDROID_H_