Popular sites on the NTP: check that experiment group StartsWith (rather than IS...
[chromium-blink-merge.git] / chrome / browser / ui / cocoa / javascript_app_modal_dialog_cocoa.h
blob9a0dd56631821dfae5ee2cf8fcf480140bdf5499
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/native_app_modal_dialog.h"
13 class AppModalDialogHelper;
15 #if __OBJC__
16 @class NSAlert;
17 @class JavaScriptAppModalDialogHelper;
18 #else
19 class NSAlert;
20 class JavaScriptAppModalDialogHelper;
21 #endif
23 class JavaScriptAppModalDialogCocoa : public app_modal::NativeAppModalDialog {
24 public:
25 explicit JavaScriptAppModalDialogCocoa(
26 app_modal::JavaScriptAppModalDialog* dialog);
27 ~JavaScriptAppModalDialogCocoa() override;
29 // Overridden from NativeAppModalDialog:
30 int GetAppModalDialogButtons() const override;
31 void ShowAppModalDialog() override;
32 void ActivateAppModalDialog() override;
33 void CloseAppModalDialog() override;
34 void AcceptAppModalDialog() override;
35 void CancelAppModalDialog() override;
36 bool IsShowing() const override;
38 app_modal::JavaScriptAppModalDialog* dialog() const {
39 return dialog_.get();
42 private:
43 // Returns the NSAlert associated with the modal dialog.
44 NSAlert* GetAlert() const;
46 scoped_ptr<app_modal::JavaScriptAppModalDialog> dialog_;
47 scoped_ptr<AppModalDialogHelper> popup_helper_;
49 // Created in the constructor and destroyed in the destructor.
50 base::scoped_nsobject<JavaScriptAppModalDialogHelper> helper_;
52 bool is_showing_;
54 DISALLOW_COPY_AND_ASSIGN(JavaScriptAppModalDialogCocoa);
57 #endif // CHROME_BROWSER_UI_COCOA_JAVASCRIPT_APP_MODAL_DIALOG_COCOA_H_