Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(87)

Side by Side Diff: ui/views/window/dialog_delegate.h

Issue 18179004: Dismiss action in tab modal dialogs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix test for Mac Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/views/window/dialog_client_view.cc ('k') | ui/views/window/dialog_delegate.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 UI_VIEWS_WINDOW_DIALOG_DELEGATE_H_ 5 #ifndef UI_VIEWS_WINDOW_DIALOG_DELEGATE_H_
6 #define UI_VIEWS_WINDOW_DIALOG_DELEGATE_H_ 6 #define UI_VIEWS_WINDOW_DIALOG_DELEGATE_H_
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/strings/string16.h" 9 #include "base/strings/string16.h"
10 #include "ui/base/accessibility/accessibility_types.h" 10 #include "ui/base/accessibility/accessibility_types.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 // Override this function to display an extra view in the titlebar. 47 // Override this function to display an extra view in the titlebar.
48 // Overrides may construct the view; this will only be called once per dialog. 48 // Overrides may construct the view; this will only be called once per dialog.
49 // Note: this only works for new style dialogs. 49 // Note: this only works for new style dialogs.
50 virtual View* CreateTitlebarExtraView(); 50 virtual View* CreateTitlebarExtraView();
51 51
52 // Override this function to display a footnote view below the buttons. 52 // Override this function to display a footnote view below the buttons.
53 // Overrides may construct the view; this will only be called once per dialog. 53 // Overrides may construct the view; this will only be called once per dialog.
54 virtual View* CreateFootnoteView(); 54 virtual View* CreateFootnoteView();
55 55
56 // For Dialog boxes, if there is a "Cancel" button or no dialog button at all, 56 // For Dialog boxes, if there is a "Cancel" button or no dialog button at all,
57 // this is called when the user presses the "Cancel" button or the Close 57 // this is called when the user presses the "Cancel" button or the Esc key.
58 // button on the window or in the system menu, or presses the Esc key. 58 // It can also be called on a close action if |Close| has not been
59 // This function should return true if the window can be closed after it 59 // overridden. This function should return true if the window can be closed
60 // returns, or false if it must remain open. 60 // after it returns, or false if it must remain open.
61 virtual bool Cancel(); 61 virtual bool Cancel();
62 62
63 // For Dialog boxes, this is called when the user presses the "OK" button, 63 // For Dialog boxes, this is called when the user presses the "OK" button,
64 // or the Enter key. Can also be called on Esc key or close button 64 // or the Enter key. It can also be called on a close action if |Close|
65 // presses if there is no "Cancel" button. This function should return 65 // has not been overridden. This function should return true if the window
66 // true if the window can be closed after it returns, or false if it must 66 // can be closed after it returns, or false if it must remain open.
67 // remain open. If |window_closing| is true, it means that this handler is 67 // If |window_closing| is true, it means that this handler is
68 // being called because the window is being closed (e.g. by Window::Close) 68 // being called because the window is being closed (e.g. by Window::Close)
69 // and there is no Cancel handler, so Accept is being called instead. 69 // and there is no Cancel handler, so Accept is being called instead.
70 virtual bool Accept(bool window_closing); 70 virtual bool Accept(bool window_closing);
71 virtual bool Accept(); 71 virtual bool Accept();
72 72
73 // Called when the user closes the window without selecting an option,
74 // e.g. by pressing the close button on the window or using a window manager
75 // gesture. By default, this calls Accept() if the only button in the dialog
76 // is Accept, Cancel() otherwise. This function should return true if the
77 // window can be closed after it returns, or false if it must remain open.
78 virtual bool Close();
79
73 // Overridden from ui::DialogModel: 80 // Overridden from ui::DialogModel:
74 virtual base::string16 GetDialogLabel() const OVERRIDE; 81 virtual base::string16 GetDialogLabel() const OVERRIDE;
75 virtual base::string16 GetDialogTitle() const OVERRIDE; 82 virtual base::string16 GetDialogTitle() const OVERRIDE;
76 virtual int GetDialogButtons() const OVERRIDE; 83 virtual int GetDialogButtons() const OVERRIDE;
77 virtual int GetDefaultDialogButton() const OVERRIDE; 84 virtual int GetDefaultDialogButton() const OVERRIDE;
78 virtual bool ShouldDefaultButtonBeBlue() const OVERRIDE; 85 virtual bool ShouldDefaultButtonBeBlue() const OVERRIDE;
79 virtual base::string16 GetDialogButtonLabel( 86 virtual base::string16 GetDialogButtonLabel(
80 ui::DialogButton button) const OVERRIDE; 87 ui::DialogButton button) const OVERRIDE;
81 virtual bool IsDialogButtonEnabled(ui::DialogButton button) const OVERRIDE; 88 virtual bool IsDialogButtonEnabled(ui::DialogButton button) const OVERRIDE;
82 89
(...skipping 11 matching lines...) Expand all
94 // support arrows. 101 // support arrows.
95 // 102 //
96 // TODO(wittman): Remove once WinAura is in place. 103 // TODO(wittman): Remove once WinAura is in place.
97 static NonClientFrameView* CreateNewStyleFrameView(Widget* widget, 104 static NonClientFrameView* CreateNewStyleFrameView(Widget* widget,
98 bool force_opaque_border); 105 bool force_opaque_border);
99 106
100 // Returns whether this particular dialog should use the new dialog style. 107 // Returns whether this particular dialog should use the new dialog style.
101 virtual bool UseNewStyleForThisDialog() const; 108 virtual bool UseNewStyleForThisDialog() const;
102 109
103 // Called when the window has been closed. 110 // Called when the window has been closed.
104 virtual void OnClose() {} 111 virtual void OnClosed() {}
105 112
106 // A helper for accessing the DialogClientView object contained by this 113 // A helper for accessing the DialogClientView object contained by this
107 // delegate's Window. 114 // delegate's Window.
108 const DialogClientView* GetDialogClientView() const; 115 const DialogClientView* GetDialogClientView() const;
109 DialogClientView* GetDialogClientView(); 116 DialogClientView* GetDialogClientView();
110 117
111 protected: 118 protected:
112 // Overridden from WidgetDelegate: 119 // Overridden from WidgetDelegate:
113 virtual ui::AccessibilityTypes::Role GetAccessibleWindowRole() const OVERRIDE; 120 virtual ui::AccessibilityTypes::Role GetAccessibleWindowRole() const OVERRIDE;
114 }; 121 };
(...skipping 14 matching lines...) Expand all
129 virtual const Widget* GetWidget() const OVERRIDE; 136 virtual const Widget* GetWidget() const OVERRIDE;
130 virtual View* GetContentsView() OVERRIDE; 137 virtual View* GetContentsView() OVERRIDE;
131 138
132 private: 139 private:
133 DISALLOW_COPY_AND_ASSIGN(DialogDelegateView); 140 DISALLOW_COPY_AND_ASSIGN(DialogDelegateView);
134 }; 141 };
135 142
136 } // namespace views 143 } // namespace views
137 144
138 #endif // UI_VIEWS_WINDOW_DIALOG_DELEGATE_H_ 145 #endif // UI_VIEWS_WINDOW_DIALOG_DELEGATE_H_
OLDNEW
« no previous file with comments | « ui/views/window/dialog_client_view.cc ('k') | ui/views/window/dialog_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698