Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / ui / cocoa / javascript_app_modal_dialog_cocoa.h
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.
4
5 #ifndef CHROME_BROWSER_UI_COCOA_JAVASCRIPT_APP_MODAL_DIALOG_COCOA_H_
6 #define CHROME_BROWSER_UI_COCOA_JAVASCRIPT_APP_MODAL_DIALOG_COCOA_H_
7
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"
12
13 #if __OBJC__
14 @class NSAlert;
15 @class JavaScriptAppModalDialogHelper;
16 #else
17 class NSAlert;
18 class JavaScriptAppModalDialogHelper;
19 #endif
20
21 class JavaScriptAppModalDialogCocoa : public NativeAppModalDialog {
22  public:
23   explicit JavaScriptAppModalDialogCocoa(JavaScriptAppModalDialog* dialog);
24   virtual ~JavaScriptAppModalDialogCocoa();
25
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;
33
34   JavaScriptAppModalDialog* dialog() const { return dialog_.get(); }
35
36  private:
37   // Returns the NSAlert associated with the modal dialog.
38   NSAlert* GetAlert() const;
39
40   scoped_ptr<JavaScriptAppModalDialog> dialog_;
41
42   // Created in the constructor and destroyed in the destructor.
43   base::scoped_nsobject<JavaScriptAppModalDialogHelper> helper_;
44
45   DISALLOW_COPY_AND_ASSIGN(JavaScriptAppModalDialogCocoa);
46 };
47
48 #endif  // CHROME_BROWSER_UI_COCOA_JAVASCRIPT_APP_MODAL_DIALOG_COCOA_H_