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

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

Issue 2901273003: chromeos: Remove TrayBubbleView::Delegate::OnBeforeBubbleWidgetInit (Closed)
Patch Set: nit 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
« no previous file with comments | « ui/views/bubble/bubble_dialog_delegate.h ('k') | ui/views/bubble/tray_bubble_view.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_BUBBLE_TRAY_BUBBLE_VIEW_H_ 5 #ifndef UI_VIEWS_BUBBLE_TRAY_BUBBLE_VIEW_H_
6 #define UI_VIEWS_BUBBLE_TRAY_BUBBLE_VIEW_H_ 6 #define UI_VIEWS_BUBBLE_TRAY_BUBBLE_VIEW_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/optional.h" 11 #include "base/optional.h"
12 #include "ui/gfx/native_widget_types.h"
12 #include "ui/views/bubble/bubble_dialog_delegate.h" 13 #include "ui/views/bubble/bubble_dialog_delegate.h"
13 #include "ui/views/mouse_watcher.h" 14 #include "ui/views/mouse_watcher.h"
14 #include "ui/views/views_export.h" 15 #include "ui/views/views_export.h"
15 16
16 namespace views { 17 namespace views {
17 class BoxLayout; 18 class BoxLayout;
18 class View; 19 class View;
19 class Widget; 20 class Widget;
20 } 21 }
21 22
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 // Called when the mouse enters/exits the view. 55 // Called when the mouse enters/exits the view.
55 // Note: This event will only be called if the mouse gets actively moved by 56 // Note: This event will only be called if the mouse gets actively moved by
56 // the user to enter the view. 57 // the user to enter the view.
57 virtual void OnMouseEnteredView() = 0; 58 virtual void OnMouseEnteredView() = 0;
58 virtual void OnMouseExitedView() = 0; 59 virtual void OnMouseExitedView() = 0;
59 60
60 // Called from GetAccessibleNodeData(); should return the appropriate 61 // Called from GetAccessibleNodeData(); should return the appropriate
61 // accessible name for the bubble. 62 // accessible name for the bubble.
62 virtual base::string16 GetAccessibleNameForBubble() = 0; 63 virtual base::string16 GetAccessibleNameForBubble() = 0;
63 64
64 // Called before Widget::Init() on |bubble_widget|. Allows |params| to be
65 // modified.
66 // TODO(jamescook): Eliminate this method. It was introduced to let mash set
67 // the widget container back when mash could not use aura::Window. Now the
68 // anchor view should be sufficient.
69 virtual void OnBeforeBubbleWidgetInit(Widget* anchor_widget,
70 Widget* bubble_widget,
71 Widget::InitParams* params) const = 0;
72
73 // Called when a bubble wants to hide/destroy itself (e.g. last visible 65 // Called when a bubble wants to hide/destroy itself (e.g. last visible
74 // child view was closed). 66 // child view was closed).
75 virtual void HideBubble(const TrayBubbleView* bubble_view) = 0; 67 virtual void HideBubble(const TrayBubbleView* bubble_view) = 0;
76 68
77 private: 69 private:
78 DISALLOW_COPY_AND_ASSIGN(Delegate); 70 DISALLOW_COPY_AND_ASSIGN(Delegate);
79 }; 71 };
80 72
81 struct VIEWS_EXPORT InitParams { 73 struct VIEWS_EXPORT InitParams {
82 InitParams(AnchorAlignment anchor_alignment, int min_width, int max_width); 74 InitParams();
83 InitParams(const InitParams& other); 75 InitParams(const InitParams& other);
84 AnchorAlignment anchor_alignment; 76 Delegate* delegate = nullptr;
85 int min_width; 77 gfx::NativeWindow parent_window = nullptr;
86 int max_width; 78 View* anchor_view = nullptr;
87 int max_height; 79 AnchorAlignment anchor_alignment = ANCHOR_ALIGNMENT_BOTTOM;
88 bool can_activate; 80 int min_width = 0;
89 bool close_on_deactivate; 81 int max_width = 0;
82 int max_height = 0;
83 bool can_activate = false;
84 bool close_on_deactivate = true;
90 // If not provided, the bg color will be derived from the NativeTheme. 85 // If not provided, the bg color will be derived from the NativeTheme.
91 base::Optional<SkColor> bg_color; 86 base::Optional<SkColor> bg_color;
92 }; 87 };
93 88
94 // Constructs and returns a TrayBubbleView. |init_params| may be modified. 89 explicit TrayBubbleView(const InitParams& init_params);
95 static TrayBubbleView* Create(views::View* anchor,
96 Delegate* delegate,
97 InitParams* init_params);
98
99 ~TrayBubbleView() override; 90 ~TrayBubbleView() override;
100 91
101 // Returns whether a tray bubble is active. 92 // Returns whether a tray bubble is active.
102 static bool IsATrayBubbleOpen(); 93 static bool IsATrayBubbleOpen();
103 94
104 // Sets up animations, and show the bubble. Must occur after CreateBubble() 95 // Sets up animations, and show the bubble. Must occur after CreateBubble()
105 // is called. 96 // is called.
106 void InitializeAndShowBubble(); 97 void InitializeAndShowBubble();
107 98
108 // Called whenever the bubble size or location may have changed. 99 // Called whenever the bubble size or location may have changed.
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 gfx::Size GetMaximumSize() const override; 136 gfx::Size GetMaximumSize() const override;
146 int GetHeightForWidth(int width) const override; 137 int GetHeightForWidth(int width) const override;
147 void OnMouseEntered(const ui::MouseEvent& event) override; 138 void OnMouseEntered(const ui::MouseEvent& event) override;
148 void OnMouseExited(const ui::MouseEvent& event) override; 139 void OnMouseExited(const ui::MouseEvent& event) override;
149 void GetAccessibleNodeData(ui::AXNodeData* node_data) override; 140 void GetAccessibleNodeData(ui::AXNodeData* node_data) override;
150 141
151 // Overridden from MouseWatcherListener 142 // Overridden from MouseWatcherListener
152 void MouseMovedOutOfHost() override; 143 void MouseMovedOutOfHost() override;
153 144
154 protected: 145 protected:
155 TrayBubbleView(views::View* anchor,
156 Delegate* delegate,
157 const InitParams& init_params);
158
159 // Overridden from views::BubbleDialogDelegateView. 146 // Overridden from views::BubbleDialogDelegateView.
160 int GetDialogButtons() const override; 147 int GetDialogButtons() const override;
161 148
162 // Overridden from views::View. 149 // Overridden from views::View.
163 void ChildPreferredSizeChanged(View* child) override; 150 void ChildPreferredSizeChanged(View* child) override;
164 void ViewHierarchyChanged( 151 void ViewHierarchyChanged(
165 const ViewHierarchyChangedDetails& details) override; 152 const ViewHierarchyChangedDetails& details) override;
166 153
167 private: 154 private:
168 InitParams params_; 155 InitParams params_;
(...skipping 13 matching lines...) Expand all
182 169
183 // Used to find any mouse movements. 170 // Used to find any mouse movements.
184 std::unique_ptr<MouseWatcher> mouse_watcher_; 171 std::unique_ptr<MouseWatcher> mouse_watcher_;
185 172
186 DISALLOW_COPY_AND_ASSIGN(TrayBubbleView); 173 DISALLOW_COPY_AND_ASSIGN(TrayBubbleView);
187 }; 174 };
188 175
189 } // namespace views 176 } // namespace views
190 177
191 #endif // UI_VIEWS_BUBBLE_TRAY_BUBBLE_VIEW_H_ 178 #endif // UI_VIEWS_BUBBLE_TRAY_BUBBLE_VIEW_H_
OLDNEW
« no previous file with comments | « ui/views/bubble/bubble_dialog_delegate.h ('k') | ui/views/bubble/tray_bubble_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698