summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui/cocoa/js_modal_dialog_cocoa.h
blob: 9179b04ead5b1923669b539addbfe8ba5438870e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_BROWSER_UI_COCOA_JS_MODAL_DIALOG_COCOA_H_
#define CHROME_BROWSER_UI_COCOA_JS_MODAL_DIALOG_COCOA_H_
#pragma once

#include "chrome/browser/ui/app_modal_dialogs/native_app_modal_dialog.h"

#include "base/logging.h"
#include "base/scoped_nsobject.h"
#include "base/scoped_ptr.h"

#if __OBJC__
@class NSAlert;
@class JavaScriptAppModalDialogHelper;
#else
class NSAlert;
class JavaScriptAppModalDialogHelper;
#endif

class JSModalDialogCocoa : public NativeAppModalDialog {
 public:
  explicit JSModalDialogCocoa(JavaScriptAppModalDialog* dialog);
  virtual ~JSModalDialogCocoa();

  // Overridden from NativeAppModalDialog:
  virtual int GetAppModalDialogButtons() const;
  virtual void ShowAppModalDialog();
  virtual void ActivateAppModalDialog();
  virtual void CloseAppModalDialog();
  virtual void AcceptAppModalDialog();
  virtual void CancelAppModalDialog();

  JavaScriptAppModalDialog* dialog() const { return dialog_.get(); }

 private:
  scoped_ptr<JavaScriptAppModalDialog> dialog_;

  scoped_nsobject<JavaScriptAppModalDialogHelper> helper_;
  NSAlert* alert_; // weak, owned by |helper_|.

  DISALLOW_COPY_AND_ASSIGN(JSModalDialogCocoa);
};

#endif  // CHROME_BROWSER_UI_COCOA_JS_MODAL_DIALOG_COCOA_H_