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

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

Issue 2785683003: views: implement width snapping for DialogDelegateViews (Closed)
Patch Set: Created 3 years, 8 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_INFO_BUBBLE_H_ 5 #ifndef UI_VIEWS_BUBBLE_INFO_BUBBLE_H_
6 #define UI_VIEWS_BUBBLE_INFO_BUBBLE_H_ 6 #define UI_VIEWS_BUBBLE_INFO_BUBBLE_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"
(...skipping 10 matching lines...) Expand all
21 ~InfoBubble() override; 21 ~InfoBubble() override;
22 22
23 // Shows the bubble. |widget_| will be NULL until this is called. 23 // Shows the bubble. |widget_| will be NULL until this is called.
24 void Show(); 24 void Show();
25 25
26 // Hides and closes the bubble. 26 // Hides and closes the bubble.
27 void Hide(); 27 void Hide();
28 28
29 // BubbleDialogDelegateView: 29 // BubbleDialogDelegateView:
30 NonClientFrameView* CreateNonClientFrameView(Widget* widget) override; 30 NonClientFrameView* CreateNonClientFrameView(Widget* widget) override;
31 gfx::Size GetPreferredSize() const override;
32 void OnWidgetDestroyed(Widget* widget) override; 31 void OnWidgetDestroyed(Widget* widget) override;
33 void OnWidgetBoundsChanged(Widget* widget, 32 void OnWidgetBoundsChanged(Widget* widget,
34 const gfx::Rect& new_bounds) override; 33 const gfx::Rect& new_bounds) override;
35 int GetDialogButtons() const override; 34 int GetDialogButtons() const override;
36 35
36 // DialogDelegateView:
37 gfx::Size GetUnsnappedPreferredSize() const override;
Peter Kasting 2017/03/30 00:35:36 Nit: Leave in above list
38
37 View* anchor() { return anchor_; } 39 View* anchor() { return anchor_; }
38 const View* anchor() const { return anchor_; } 40 const View* anchor() const { return anchor_; }
39 41
40 void set_preferred_width(int preferred_width) { 42 void set_preferred_width(int preferred_width) {
41 preferred_width_ = preferred_width; 43 preferred_width_ = preferred_width;
42 } 44 }
43 45
44 private: 46 private:
45 // Updates the position of the bubble. 47 // Updates the position of the bubble.
46 void UpdatePosition(); 48 void UpdatePosition();
47 49
48 Widget* widget_; // Weak, may be NULL. 50 Widget* widget_; // Weak, may be NULL.
49 View* const anchor_; // Weak. 51 View* const anchor_; // Weak.
50 InfoBubbleFrame* frame_; // Weak, owned by widget. 52 InfoBubbleFrame* frame_; // Weak, owned by widget.
51 53
52 // The width this bubble prefers to be. Default is 0 (no preference). 54 // The width this bubble prefers to be. Default is 0 (no preference).
53 int preferred_width_; 55 int preferred_width_;
54 56
55 DISALLOW_COPY_AND_ASSIGN(InfoBubble); 57 DISALLOW_COPY_AND_ASSIGN(InfoBubble);
56 }; 58 };
57 59
58 } // namespace views 60 } // namespace views
59 61
60 #endif // UI_VIEWS_BUBBLE_INFO_BUBBLE_H_ 62 #endif // UI_VIEWS_BUBBLE_INFO_BUBBLE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698