summaryrefslogtreecommitdiffstats
path: root/chrome/views/window/dialog_delegate.h
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/views/window/dialog_delegate.h')
-rw-r--r--chrome/views/window/dialog_delegate.h52
1 files changed, 27 insertions, 25 deletions
diff --git a/chrome/views/window/dialog_delegate.h b/chrome/views/window/dialog_delegate.h
index b8b2d1b..8add450 100644
--- a/chrome/views/window/dialog_delegate.h
+++ b/chrome/views/window/dialog_delegate.h
@@ -5,6 +5,7 @@
#ifndef CHROME_VIEWS_WINDOW_DIALOG_DELEGATE_H_
#define CHROME_VIEWS_WINDOW_DIALOG_DELEGATE_H_
+#include "chrome/common/message_box_flags.h"
#include "chrome/views/window/dialog_client_view.h"
#include "chrome/views/window/window_delegate.h"
@@ -26,12 +27,6 @@ class DialogDelegate : public WindowDelegate {
public:
virtual DialogDelegate* AsDialogDelegate() { return this; }
- enum DialogButton {
- DIALOGBUTTON_NONE = 0, // No dialog buttons, for WindowType == WINDOW.
- DIALOGBUTTON_OK = 1, // Has an OK button.
- DIALOGBUTTON_CANCEL = 2, // Has a Cancel button (becomes a Close button if
- }; // no OK button).
-
// Returns a mask specifying which of the available DialogButtons are visible
// for the dialog. Note: If an OK button is provided, you should provide a
// CANCEL button. A dialog box with just an OK button is frowned upon and
@@ -40,18 +35,22 @@ class DialogDelegate : public WindowDelegate {
//
// To use the extra button you need to override GetDialogButtons()
virtual int GetDialogButtons() const {
- return DIALOGBUTTON_OK | DIALOGBUTTON_CANCEL;
+ return MessageBoxFlags::DIALOGBUTTON_OK |
+ MessageBoxFlags::DIALOGBUTTON_CANCEL;
}
// Returns whether accelerators are enabled on the button. This is invoked
// when an accelerator is pressed, not at construction time. This
// returns true.
- virtual bool AreAcceleratorsEnabled(DialogButton button) { return true; }
+ virtual bool AreAcceleratorsEnabled(MessageBoxFlags::DialogButton button) {
+ return true;
+ }
// Returns the label of the specified DialogButton.
- virtual std::wstring GetDialogButtonLabel(DialogButton button) const {
- // empty string results in defaults for DIALOGBUTTON_OK,
- // DIALOGBUTTON_CANCEL.
+ virtual std::wstring GetDialogButtonLabel(
+ MessageBoxFlags::DialogButton button) const {
+ // empty string results in defaults for MessageBoxFlags::DIALOGBUTTON_OK,
+ // MessageBoxFlags::DIALOGBUTTON_CANCEL.
return L"";
}
@@ -60,20 +59,23 @@ class DialogDelegate : public WindowDelegate {
// up to the buttons.
virtual View* GetExtraView() { return NULL; }
- // Returns the default dialog button. This should not be a mask as only one
- // button should ever be the default button. Return DIALOGBUTTON_NONE if
- // there is no default. Default behavior is to return DIALOGBUTTON_OK or
- // DIALOGBUTTON_CANCEL (in that order) if they are present, DIALOGBUTTON_NONE
- // otherwise.
+ // Returns the default dialog button. This should not be a mask as only
+ // one button should ever be the default button. Return
+ // MessageBoxFlags::DIALOGBUTTON_NONE if there is no default. Default
+ // behavior is to return MessageBoxFlags::DIALOGBUTTON_OK or
+ // MessageBoxFlags::DIALOGBUTTON_CANCEL (in that order) if they are
+ // present, MessageBoxFlags::DIALOGBUTTON_NONE otherwise.
virtual int GetDefaultDialogButton() const;
// Returns whether the specified dialog button is enabled.
- virtual bool IsDialogButtonEnabled(DialogButton button) const {
+ virtual bool IsDialogButtonEnabled(
+ MessageBoxFlags::DialogButton button) const {
return true;
}
// Returns whether the specified dialog button is visible.
- virtual bool IsDialogButtonVisible(DialogButton button) const {
+ virtual bool IsDialogButtonVisible(
+ MessageBoxFlags::DialogButton button) const {
return true;
}
@@ -85,13 +87,13 @@ class DialogDelegate : public WindowDelegate {
virtual bool Cancel() { return true; }
// For Dialog boxes, this is called when the user presses the "OK" button,
- // or the Enter key. Can also be called on Esc key or close button presses if
- // there is no "Cancel" button. This function should return true if the window
- // can be closed after the window can be closed after it returns, or false if
- // it must remain open. If |window_closing| is true, it means that this
- // handler is being called because the window is being closed (e.g. by
- // Window::Close) and there is no Cancel handler, so Accept is being called
- // instead.
+ // or the Enter key. Can also be called on Esc key or close button
+ // presses if there is no "Cancel" button. This function should return
+ // true if the window can be closed after the window can be closed after
+ // it returns, or false if it must remain open. If |window_closing| is
+ // true, it means that this handler is being called because the window is
+ // being closed (e.g. by Window::Close) and there is no Cancel handler,
+ // so Accept is being called instead.
virtual bool Accept(bool window_closing) { return Accept(); }
virtual bool Accept() { return true; }