summaryrefslogtreecommitdiffstats
path: root/chrome/views/dialog_delegate.h
diff options
context:
space:
mode:
authorbeng@google.com <beng@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-07-31 00:42:17 +0000
committerbeng@google.com <beng@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-07-31 00:42:17 +0000
commitb2a4b9f96997dc3b929b5b9930325a030a8294e3 (patch)
tree3b18dd4002b9f6b681dd8256783f9d308591568f /chrome/views/dialog_delegate.h
parentcd5241ff75071da8e4345e81ebc220e17505a306 (diff)
downloadchromium_src-b2a4b9f96997dc3b929b5b9930325a030a8294e3.zip
chromium_src-b2a4b9f96997dc3b929b5b9930325a030a8294e3.tar.gz
chromium_src-b2a4b9f96997dc3b929b5b9930325a030a8294e3.tar.bz2
Move dialog-specific aspects of ClientView into a new subclass DialogClientView.
ClientView becomes a generic representation of the View that occupies the "client area" of a window. All Windows now require a Client View (though they can use the default). Adjust WindowDelegate to provide a method for constructing the ClientView for a Window. The DialogDelegate overrides this to construct the DialogClientView. In the future, other specialized delegates will construct ClientViews specific to them, e.g. WizardDelegate would construct WizardClientView. Adjust the Window Init method to set up this new required Client View, and make some tweaks to CustomFrameWindow to make all this work. Remove all traces of dialog specific handling in Window into DialogClientView. B=1280060 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@153 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/views/dialog_delegate.h')
-rw-r--r--chrome/views/dialog_delegate.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/chrome/views/dialog_delegate.h b/chrome/views/dialog_delegate.h
index 2dc48e6..9ca4ade 100644
--- a/chrome/views/dialog_delegate.h
+++ b/chrome/views/dialog_delegate.h
@@ -30,6 +30,7 @@
#ifndef CHROME_VIEWS_DIALOG_DELEGATE_H__
#define CHROME_VIEWS_DIALOG_DELEGATE_H__
+#include "chrome/views/dialog_client_view.h"
#include "chrome/views/window_delegate.h"
namespace ChromeViews {
@@ -119,6 +120,31 @@ class DialogDelegate : public WindowDelegate {
// instead.
virtual bool Accept(bool window_closing) { return Accept(); }
virtual bool Accept() { return true; }
+
+ // Overridden from WindowDelegate:
+ virtual View* GetInitiallyFocusedView() const {
+ // Try to focus the OK then the Cancel button if present.
+ DialogClientView* dcv = GetDialogClientView();
+ if (GetDialogButtons() & DIALOGBUTTON_OK)
+ return dcv->ok_button();
+ if (GetDialogButtons() & DIALOGBUTTON_CANCEL)
+ return dcv->cancel_button();
+ return NULL;
+ }
+
+ // Overridden from WindowDelegate:
+ virtual ClientView* CreateClientView(Window* window) {
+ return new DialogClientView(window, GetContentsView());
+ }
+
+ // A helper for accessing the DialogClientView object contained by this
+ // delegate's Window.
+ DialogClientView* GetDialogClientView() const {
+ ClientView* client_view = window()->client_view();
+ DialogClientView* dialog_client_view = client_view->AsDialogClientView();
+ DCHECK(dialog_client_view);
+ return dialog_client_view;
+ }
};
} // namespace ChromeViews