| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_UI_COCOA_JAVASCRIPT_APP_MODAL_DIALOG_COCOA_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_JAVASCRIPT_APP_MODAL_DIALOG_COCOA_H_ |
| 6 #define CHROME_BROWSER_UI_COCOA_JAVASCRIPT_APP_MODAL_DIALOG_COCOA_H_ | 6 #define CHROME_BROWSER_UI_COCOA_JAVASCRIPT_APP_MODAL_DIALOG_COCOA_H_ |
| 7 | 7 |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/mac/scoped_nsobject.h" | 9 #include "base/mac/scoped_nsobject.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "components/app_modal_dialogs/native_app_modal_dialog.h" | 11 #include "components/app_modal_dialogs/native_app_modal_dialog.h" |
| 12 | 12 |
| 13 #if __OBJC__ | 13 #if __OBJC__ |
| 14 @class NSAlert; | 14 @class NSAlert; |
| 15 @class JavaScriptAppModalDialogHelper; | 15 @class JavaScriptAppModalDialogHelper; |
| 16 #else | 16 #else |
| 17 class NSAlert; | 17 class NSAlert; |
| 18 class JavaScriptAppModalDialogHelper; | 18 class JavaScriptAppModalDialogHelper; |
| 19 #endif | 19 #endif |
| 20 | 20 |
| 21 class JavaScriptAppModalDialogCocoa : public NativeAppModalDialog { | 21 class JavaScriptAppModalDialogCocoa |
| 22 : public app_modal_dialogs::NativeAppModalDialog { |
| 22 public: | 23 public: |
| 23 explicit JavaScriptAppModalDialogCocoa(JavaScriptAppModalDialog* dialog); | 24 explicit JavaScriptAppModalDialogCocoa( |
| 25 app_modal_dialogs::JavaScriptAppModalDialog* dialog); |
| 24 virtual ~JavaScriptAppModalDialogCocoa(); | 26 virtual ~JavaScriptAppModalDialogCocoa(); |
| 25 | 27 |
| 26 // Overridden from NativeAppModalDialog: | 28 // Overridden from NativeAppModalDialog: |
| 27 int GetAppModalDialogButtons() const override; | 29 int GetAppModalDialogButtons() const override; |
| 28 void ShowAppModalDialog() override; | 30 void ShowAppModalDialog() override; |
| 29 void ActivateAppModalDialog() override; | 31 void ActivateAppModalDialog() override; |
| 30 void CloseAppModalDialog() override; | 32 void CloseAppModalDialog() override; |
| 31 void AcceptAppModalDialog() override; | 33 void AcceptAppModalDialog() override; |
| 32 void CancelAppModalDialog() override; | 34 void CancelAppModalDialog() override; |
| 33 | 35 |
| 34 JavaScriptAppModalDialog* dialog() const { return dialog_.get(); } | 36 app_modal_dialogs::JavaScriptAppModalDialog* dialog() const { |
| 37 return dialog_.get(); |
| 38 } |
| 35 | 39 |
| 36 private: | 40 private: |
| 37 // Returns the NSAlert associated with the modal dialog. | 41 // Returns the NSAlert associated with the modal dialog. |
| 38 NSAlert* GetAlert() const; | 42 NSAlert* GetAlert() const; |
| 39 | 43 |
| 40 scoped_ptr<JavaScriptAppModalDialog> dialog_; | 44 scoped_ptr<app_modal_dialogs::JavaScriptAppModalDialog> dialog_; |
| 41 | 45 |
| 42 // Created in the constructor and destroyed in the destructor. | 46 // Created in the constructor and destroyed in the destructor. |
| 43 base::scoped_nsobject<JavaScriptAppModalDialogHelper> helper_; | 47 base::scoped_nsobject<JavaScriptAppModalDialogHelper> helper_; |
| 44 | 48 |
| 45 DISALLOW_COPY_AND_ASSIGN(JavaScriptAppModalDialogCocoa); | 49 DISALLOW_COPY_AND_ASSIGN(JavaScriptAppModalDialogCocoa); |
| 46 }; | 50 }; |
| 47 | 51 |
| 48 #endif // CHROME_BROWSER_UI_COCOA_JAVASCRIPT_APP_MODAL_DIALOG_COCOA_H_ | 52 #endif // CHROME_BROWSER_UI_COCOA_JAVASCRIPT_APP_MODAL_DIALOG_COCOA_H_ |
| OLD | NEW |