| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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_APP_MODAL_DIALOGS_APP_MODAL_DIALOG_H_ | 5 #ifndef CHROME_BROWSER_UI_APP_MODAL_DIALOGS_APP_MODAL_DIALOG_H_ |
| 6 #define CHROME_BROWSER_UI_APP_MODAL_DIALOGS_APP_MODAL_DIALOG_H_ | 6 #define CHROME_BROWSER_UI_APP_MODAL_DIALOGS_APP_MODAL_DIALOG_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/string16.h" |
| 12 #include "build/build_config.h" | 13 #include "build/build_config.h" |
| 13 | 14 |
| 14 class NativeAppModalDialog; | 15 class NativeAppModalDialog; |
| 15 class TabContents; | 16 class TabContents; |
| 16 | 17 |
| 17 // A controller+model base class for modal dialogs. | 18 // A controller+model base class for modal dialogs. |
| 18 class AppModalDialog { | 19 class AppModalDialog { |
| 19 public: | 20 public: |
| 20 // A union of data necessary to determine the type of message box to | 21 // A union of data necessary to determine the type of message box to |
| 21 // show. |tab_contents| parameter is optional, if provided that tab will be | 22 // show. |tab_contents| parameter is optional, if provided that tab will be |
| 22 // activated before the modal dialog is displayed. | 23 // activated before the modal dialog is displayed. |
| 23 AppModalDialog(TabContents* tab_contents, const std::wstring& title); | 24 AppModalDialog(TabContents* tab_contents, const string16& title); |
| 24 virtual ~AppModalDialog(); | 25 virtual ~AppModalDialog(); |
| 25 | 26 |
| 26 // Called by the AppModalDialogQueue to show this dialog. | 27 // Called by the AppModalDialogQueue to show this dialog. |
| 27 void ShowModalDialog(); | 28 void ShowModalDialog(); |
| 28 | 29 |
| 29 // Called by the AppModalDialogQueue to activate the dialog. | 30 // Called by the AppModalDialogQueue to activate the dialog. |
| 30 void ActivateModalDialog(); | 31 void ActivateModalDialog(); |
| 31 | 32 |
| 32 // Closes the dialog if it is showing. | 33 // Closes the dialog if it is showing. |
| 33 void CloseModalDialog(); | 34 void CloseModalDialog(); |
| 34 | 35 |
| 35 // Completes dialog handling, shows next modal dialog from the queue. | 36 // Completes dialog handling, shows next modal dialog from the queue. |
| 36 // TODO(beng): Get rid of this method. | 37 // TODO(beng): Get rid of this method. |
| 37 void CompleteDialog(); | 38 void CompleteDialog(); |
| 38 | 39 |
| 39 // Dialog window title. | 40 // Dialog window title. |
| 40 std::wstring title() const { return title_; } | 41 string16 title() const { return title_; } |
| 41 | 42 |
| 42 NativeAppModalDialog* native_dialog() const { return native_dialog_; } | 43 NativeAppModalDialog* native_dialog() const { return native_dialog_; } |
| 43 | 44 |
| 44 // Methods overridable by AppModalDialog subclasses: | 45 // Methods overridable by AppModalDialog subclasses: |
| 45 | 46 |
| 46 // Creates an implementation of NativeAppModalDialog and shows it. | 47 // Creates an implementation of NativeAppModalDialog and shows it. |
| 47 // When the native dialog is closed, the implementation of | 48 // When the native dialog is closed, the implementation of |
| 48 // NativeAppModalDialog should call OnAccept or OnCancel to notify the | 49 // NativeAppModalDialog should call OnAccept or OnCancel to notify the |
| 49 // renderer of the user's action. The NativeAppModalDialog is also | 50 // renderer of the user's action. The NativeAppModalDialog is also |
| 50 // expected to delete the AppModalDialog associated with it. | 51 // expected to delete the AppModalDialog associated with it. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 69 bool skip_this_dialog_; | 70 bool skip_this_dialog_; |
| 70 | 71 |
| 71 // Parent tab contents. | 72 // Parent tab contents. |
| 72 TabContents* tab_contents_; | 73 TabContents* tab_contents_; |
| 73 | 74 |
| 74 // The toolkit-specific implementation of the app modal dialog box. | 75 // The toolkit-specific implementation of the app modal dialog box. |
| 75 NativeAppModalDialog* native_dialog_; | 76 NativeAppModalDialog* native_dialog_; |
| 76 | 77 |
| 77 private: | 78 private: |
| 78 // Information about the message box is held in the following variables. | 79 // Information about the message box is held in the following variables. |
| 79 std::wstring title_; | 80 string16 title_; |
| 80 | 81 |
| 81 DISALLOW_COPY_AND_ASSIGN(AppModalDialog); | 82 DISALLOW_COPY_AND_ASSIGN(AppModalDialog); |
| 82 }; | 83 }; |
| 83 | 84 |
| 84 #endif // CHROME_BROWSER_UI_APP_MODAL_DIALOGS_APP_MODAL_DIALOG_H_ | 85 #endif // CHROME_BROWSER_UI_APP_MODAL_DIALOGS_APP_MODAL_DIALOG_H_ |
| OLD | NEW |