1// Copyright (c) 2011 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_JS_MODAL_DIALOG_COCOA_H_
6#define CHROME_BROWSER_UI_COCOA_JS_MODAL_DIALOG_COCOA_H_
7#pragma once
8
9#include "chrome/browser/ui/app_modal_dialogs/native_app_modal_dialog.h"
10
11#include "base/logging.h"
12#include "base/memory/scoped_nsobject.h"
13#include "base/memory/scoped_ptr.h"
14
15#if __OBJC__
16@class NSAlert;
17@class JavaScriptAppModalDialogHelper;
18#else
19class NSAlert;
20class JavaScriptAppModalDialogHelper;
21#endif
22
23class JSModalDialogCocoa : public NativeAppModalDialog {
24 public:
25  explicit JSModalDialogCocoa(JavaScriptAppModalDialog* dialog);
26  virtual ~JSModalDialogCocoa();
27
28  // Overridden from NativeAppModalDialog:
29  virtual int GetAppModalDialogButtons() const;
30  virtual void ShowAppModalDialog();
31  virtual void ActivateAppModalDialog();
32  virtual void CloseAppModalDialog();
33  virtual void AcceptAppModalDialog();
34  virtual void CancelAppModalDialog();
35
36  JavaScriptAppModalDialog* dialog() const { return dialog_.get(); }
37
38 private:
39  scoped_ptr<JavaScriptAppModalDialog> dialog_;
40
41  scoped_nsobject<JavaScriptAppModalDialogHelper> helper_;
42  NSAlert* alert_; // weak, owned by |helper_|.
43
44  DISALLOW_COPY_AND_ASSIGN(JSModalDialogCocoa);
45};
46
47#endif  // CHROME_BROWSER_UI_COCOA_JS_MODAL_DIALOG_COCOA_H_
48
49