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

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

Issue 2907983002: Allow dialogs to use a custom View as their title. (Closed)
Patch Set: merge Created 3 years, 6 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
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/macros.h" 9 #include "base/macros.h"
10 #include "base/strings/string16.h" 10 #include "base/strings/string16.h"
11 #include "ui/accessibility/ax_enums.h" 11 #include "ui/accessibility/ax_enums.h"
12 #include "ui/base/models/dialog_model.h" 12 #include "ui/base/models/dialog_model.h"
13 #include "ui/base/ui_base_types.h" 13 #include "ui/base/ui_base_types.h"
14 #include "ui/views/widget/widget.h" 14 #include "ui/views/widget/widget.h"
15 #include "ui/views/widget/widget_delegate.h" 15 #include "ui/views/widget/widget_delegate.h"
16 16
17 namespace views { 17 namespace views {
18 18
19 class DialogClientView; 19 class DialogClientView;
20 class LabelButton; 20 class LabelButton;
21 class StyledLabel;
21 22
22 /////////////////////////////////////////////////////////////////////////////// 23 ///////////////////////////////////////////////////////////////////////////////
23 // 24 //
24 // DialogDelegate 25 // DialogDelegate
25 // 26 //
26 // DialogDelegate is an interface implemented by objects that wish to show a 27 // DialogDelegate is an interface implemented by objects that wish to show a
27 // dialog box Window. The window that is displayed uses this interface to 28 // dialog box Window. The window that is displayed uses this interface to
28 // determine how it should be displayed and notify the delegate object of 29 // determine how it should be displayed and notify the delegate object of
29 // certain events. 30 // certain events.
30 // 31 //
(...skipping 10 matching lines...) Expand all
41 gfx::NativeView parent); 42 gfx::NativeView parent);
42 43
43 // Returns the dialog widget InitParams for a given |context| or |parent|. 44 // Returns the dialog widget InitParams for a given |context| or |parent|.
44 // If |bounds| is not empty, used to initially place the dialog, otherwise 45 // If |bounds| is not empty, used to initially place the dialog, otherwise
45 // a default location is used. 46 // a default location is used.
46 static Widget::InitParams GetDialogWidgetInitParams(WidgetDelegate* delegate, 47 static Widget::InitParams GetDialogWidgetInitParams(WidgetDelegate* delegate,
47 gfx::NativeWindow context, 48 gfx::NativeWindow context,
48 gfx::NativeView parent, 49 gfx::NativeView parent,
49 const gfx::Rect& bounds); 50 const gfx::Rect& bounds);
50 51
52 // Returns a StyledLabel to use as the title of the bubble. By default returns
53 // nullptr to indicate the default title should be used instead.
54 virtual StyledLabel* CreateTitleView();
sky 2017/06/06 23:55:10 One concern I have with adding this here is that n
Bret 2017/06/07 00:37:46 TaskManagerView is a DialogDelegateView, so I thin
sky 2017/06/07 15:59:40 The new function you are adding is only called fro
Bret 2017/06/07 20:15:41 Okay you're right, that's kind of subtle. It doesn
55
51 // Override this function to display an extra view adjacent to the buttons. 56 // Override this function to display an extra view adjacent to the buttons.
52 // Overrides may construct the view; this will only be called once per dialog. 57 // Overrides may construct the view; this will only be called once per dialog.
53 virtual View* CreateExtraView(); 58 virtual View* CreateExtraView();
54 59
55 // Override this function to adjust the padding between the extra view and 60 // Override this function to adjust the padding between the extra view and
56 // the confirm/cancel buttons. Note that if there are no buttons, this will 61 // the confirm/cancel buttons. Note that if there are no buttons, this will
57 // not be used. 62 // not be used.
58 // If a custom padding should be used, returns true and populates |padding|. 63 // If a custom padding should be used, returns true and populates |padding|.
59 virtual bool GetExtraViewPadding(int* padding); 64 virtual bool GetExtraViewPadding(int* padding);
60 65
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 void ViewHierarchyChanged( 158 void ViewHierarchyChanged(
154 const ViewHierarchyChangedDetails& details) override; 159 const ViewHierarchyChangedDetails& details) override;
155 160
156 private: 161 private:
157 DISALLOW_COPY_AND_ASSIGN(DialogDelegateView); 162 DISALLOW_COPY_AND_ASSIGN(DialogDelegateView);
158 }; 163 };
159 164
160 } // namespace views 165 } // namespace views
161 166
162 #endif // UI_VIEWS_WINDOW_DIALOG_DELEGATE_H_ 167 #endif // UI_VIEWS_WINDOW_DIALOG_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698