blob: d32c5404efc4a1ca974733f900ccbd56fff88b29 (
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
49
50
51
52
53
54
55
56
57
58
|
// Copyright (c) 2012 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_JAVASCRIPT_APP_MODAL_DIALOG_COCOA_H_
#define CHROME_BROWSER_UI_COCOA_JAVASCRIPT_APP_MODAL_DIALOG_COCOA_H_
#include "base/logging.h"
#include "base/mac/scoped_nsobject.h"
#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "components/app_modal/native_app_modal_dialog.h"
class AppModalDialogHelper;
#if __OBJC__
@class NSAlert;
@class JavaScriptAppModalDialogHelper;
#else
class NSAlert;
class JavaScriptAppModalDialogHelper;
#endif
class JavaScriptAppModalDialogCocoa : public app_modal::NativeAppModalDialog {
public:
explicit JavaScriptAppModalDialogCocoa(
app_modal::JavaScriptAppModalDialog* dialog);
~JavaScriptAppModalDialogCocoa() override;
// Overridden from NativeAppModalDialog:
int GetAppModalDialogButtons() const override;
void ShowAppModalDialog() override;
void ActivateAppModalDialog() override;
void CloseAppModalDialog() override;
void AcceptAppModalDialog() override;
void CancelAppModalDialog() override;
bool IsShowing() const override;
app_modal::JavaScriptAppModalDialog* dialog() const {
return dialog_.get();
}
private:
// Returns the NSAlert associated with the modal dialog.
NSAlert* GetAlert() const;
scoped_ptr<app_modal::JavaScriptAppModalDialog> dialog_;
scoped_ptr<AppModalDialogHelper> popup_helper_;
// Created in the constructor and destroyed in the destructor.
base::scoped_nsobject<JavaScriptAppModalDialogHelper> helper_;
bool is_showing_;
DISALLOW_COPY_AND_ASSIGN(JavaScriptAppModalDialogCocoa);
};
#endif // CHROME_BROWSER_UI_COCOA_JAVASCRIPT_APP_MODAL_DIALOG_COCOA_H_
|