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_COCOA_JAVASCRIPT_APP_MODAL_DIALOG_COCOA_H_
6 #define CHROME_BROWSER_UI_COCOA_JAVASCRIPT_APP_MODAL_DIALOG_COCOA_H_
8 #include "base/logging.h"
9 #include "base/mac/scoped_nsobject.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "components/app_modal_dialogs/native_app_modal_dialog.h"
15 @class JavaScriptAppModalDialogHelper;
18 class JavaScriptAppModalDialogHelper;
21 class JavaScriptAppModalDialogCocoa : public NativeAppModalDialog {
23 explicit JavaScriptAppModalDialogCocoa(JavaScriptAppModalDialog* dialog);
24 virtual ~JavaScriptAppModalDialogCocoa();
26 // Overridden from NativeAppModalDialog:
27 int GetAppModalDialogButtons() const override;
28 void ShowAppModalDialog() override;
29 void ActivateAppModalDialog() override;
30 void CloseAppModalDialog() override;
31 void AcceptAppModalDialog() override;
32 void CancelAppModalDialog() override;
34 JavaScriptAppModalDialog* dialog() const { return dialog_.get(); }
37 // Returns the NSAlert associated with the modal dialog.
38 NSAlert* GetAlert() const;
40 scoped_ptr<JavaScriptAppModalDialog> dialog_;
42 // Created in the constructor and destroyed in the destructor.
43 base::scoped_nsobject<JavaScriptAppModalDialogHelper> helper_;
45 DISALLOW_COPY_AND_ASSIGN(JavaScriptAppModalDialogCocoa);
48 #endif // CHROME_BROWSER_UI_COCOA_JAVASCRIPT_APP_MODAL_DIALOG_COCOA_H_