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

Side by Side Diff: ui/views/bubble/bubble_dialog_delegate.h

Issue 2907983002: Allow dialogs to use a custom View as their title. (Closed)
Patch Set: pass strings by reference 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_BUBBLE_BUBBLE_DIALOG_DELEGATE_H_ 5 #ifndef UI_VIEWS_BUBBLE_BUBBLE_DIALOG_DELEGATE_H_
6 #define UI_VIEWS_BUBBLE_BUBBLE_DIALOG_DELEGATE_H_ 6 #define UI_VIEWS_BUBBLE_BUBBLE_DIALOG_DELEGATE_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/gtest_prod_util.h" 10 #include "base/gtest_prod_util.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "ui/views/bubble/bubble_border.h" 12 #include "ui/views/bubble/bubble_border.h"
13 #include "ui/views/widget/widget.h" 13 #include "ui/views/widget/widget.h"
14 #include "ui/views/widget/widget_observer.h" 14 #include "ui/views/widget/widget_observer.h"
15 #include "ui/views/window/dialog_delegate.h" 15 #include "ui/views/window/dialog_delegate.h"
16 16
17 namespace gfx { 17 namespace gfx {
18 class FontList;
19 class Rect; 18 class Rect;
20 } 19 }
21 20
22 namespace views { 21 namespace views {
23 22
24 class BubbleFrameView; 23 class BubbleFrameView;
25 class ViewTracker; 24 class ViewTracker;
26 25
27 // BubbleDialogDelegateView is a special DialogDelegateView for bubbles. 26 // BubbleDialogDelegateView is a special DialogDelegateView for bubbles.
28 class VIEWS_EXPORT BubbleDialogDelegateView : public DialogDelegateView, 27 class VIEWS_EXPORT BubbleDialogDelegateView : public DialogDelegateView,
(...skipping 12 matching lines...) Expand all
41 40
42 // Create and initialize the bubble Widget(s) with proper bounds. 41 // Create and initialize the bubble Widget(s) with proper bounds.
43 static Widget* CreateBubble(BubbleDialogDelegateView* bubble_delegate); 42 static Widget* CreateBubble(BubbleDialogDelegateView* bubble_delegate);
44 43
45 // WidgetDelegateView overrides: 44 // WidgetDelegateView overrides:
46 BubbleDialogDelegateView* AsBubbleDialogDelegate() override; 45 BubbleDialogDelegateView* AsBubbleDialogDelegate() override;
47 bool ShouldShowCloseButton() const override; 46 bool ShouldShowCloseButton() const override;
48 ClientView* CreateClientView(Widget* widget) override; 47 ClientView* CreateClientView(Widget* widget) override;
49 NonClientFrameView* CreateNonClientFrameView(Widget* widget) override; 48 NonClientFrameView* CreateNonClientFrameView(Widget* widget) override;
50 const char* GetClassName() const override; 49 const char* GetClassName() const override;
50 void AddedToWidget() override;
51 51
52 // WidgetObserver overrides: 52 // WidgetObserver overrides:
53 void OnWidgetDestroying(Widget* widget) override; 53 void OnWidgetDestroying(Widget* widget) override;
54 void OnWidgetVisibilityChanging(Widget* widget, bool visible) override; 54 void OnWidgetVisibilityChanging(Widget* widget, bool visible) override;
55 void OnWidgetVisibilityChanged(Widget* widget, bool visible) override; 55 void OnWidgetVisibilityChanged(Widget* widget, bool visible) override;
56 void OnWidgetActivationChanged(Widget* widget, bool active) override; 56 void OnWidgetActivationChanged(Widget* widget, bool active) override;
57 void OnWidgetBoundsChanged(Widget* widget, 57 void OnWidgetBoundsChanged(Widget* widget,
58 const gfx::Rect& new_bounds) override; 58 const gfx::Rect& new_bounds) override;
59 59
60 bool close_on_deactivate() const { return close_on_deactivate_; } 60 bool close_on_deactivate() const { return close_on_deactivate_; }
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 // bounds change as a result of the widget's bounds changing. 123 // bounds change as a result of the widget's bounds changing.
124 void OnAnchorBoundsChanged(); 124 void OnAnchorBoundsChanged();
125 125
126 protected: 126 protected:
127 BubbleDialogDelegateView(); 127 BubbleDialogDelegateView();
128 BubbleDialogDelegateView(View* anchor_view, BubbleBorder::Arrow arrow); 128 BubbleDialogDelegateView(View* anchor_view, BubbleBorder::Arrow arrow);
129 129
130 // Get bubble bounds from the anchor rect and client view's preferred size. 130 // Get bubble bounds from the anchor rect and client view's preferred size.
131 virtual gfx::Rect GetBubbleBounds(); 131 virtual gfx::Rect GetBubbleBounds();
132 132
133 // Return a FontList to use for the title of the bubble. 133 // Returns a custom view to use as the title of the dialog.
134 // (The default is MediumFont). 134 virtual View* CreateTitleView(const base::string16& title_text);
135 virtual const gfx::FontList& GetTitleFontList() const; 135
136 // Gives the custom title view returned from CreateTitleView, if there is one,
137 // to the BubbleFrameView.
138 void SetupTitleView();
Peter Kasting 2017/06/17 01:16:20 Nit: "Setup" implied to me that I could only call
Bret 2017/06/21 22:37:54 No longer relevant due to other changes.
136 139
137 // View overrides: 140 // View overrides:
138 void OnNativeThemeChanged(const ui::NativeTheme* theme) override; 141 void OnNativeThemeChanged(const ui::NativeTheme* theme) override;
139 142
140 // Perform view initialization on the contents for bubble sizing. 143 // Perform view initialization on the contents for bubble sizing.
141 virtual void Init(); 144 virtual void Init();
142 145
143 // Sets the anchor view or rect and repositions the bubble. Note that if a 146 // Sets the anchor view or rect and repositions the bubble. Note that if a
144 // valid view gets passed, the anchor rect will get ignored. If the view gets 147 // valid view gets passed, the anchor rect will get ignored. If the view gets
145 // deleted, but no new view gets set, the last known anchor postion will get 148 // deleted, but no new view gets set, the last known anchor postion will get
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 212
210 // Parent native window of the bubble. 213 // Parent native window of the bubble.
211 gfx::NativeView parent_window_; 214 gfx::NativeView parent_window_;
212 215
213 DISALLOW_COPY_AND_ASSIGN(BubbleDialogDelegateView); 216 DISALLOW_COPY_AND_ASSIGN(BubbleDialogDelegateView);
214 }; 217 };
215 218
216 } // namespace views 219 } // namespace views
217 220
218 #endif // UI_VIEWS_BUBBLE_BUBBLE_DELEGATE2_H_ 221 #endif // UI_VIEWS_BUBBLE_BUBBLE_DELEGATE2_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698