OLD | NEW |
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_BUBBLE_FRAME_VIEW_H_ | 5 #ifndef UI_VIEWS_BUBBLE_BUBBLE_FRAME_VIEW_H_ |
6 #define UI_VIEWS_BUBBLE_BUBBLE_FRAME_VIEW_H_ | 6 #define UI_VIEWS_BUBBLE_BUBBLE_FRAME_VIEW_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/gtest_prod_util.h" | 9 #include "base/gtest_prod_util.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 const char* GetClassName() const override; | 56 const char* GetClassName() const override; |
57 gfx::Insets GetInsets() const override; | 57 gfx::Insets GetInsets() const override; |
58 gfx::Size GetPreferredSize() const override; | 58 gfx::Size GetPreferredSize() const override; |
59 gfx::Size GetMinimumSize() const override; | 59 gfx::Size GetMinimumSize() const override; |
60 gfx::Size GetMaximumSize() const override; | 60 gfx::Size GetMaximumSize() const override; |
61 void Layout() override; | 61 void Layout() override; |
62 void OnPaint(gfx::Canvas* canvas) override; | 62 void OnPaint(gfx::Canvas* canvas) override; |
63 void PaintChildren(const ui::PaintContext& context) override; | 63 void PaintChildren(const ui::PaintContext& context) override; |
64 void OnThemeChanged() override; | 64 void OnThemeChanged() override; |
65 void OnNativeThemeChanged(const ui::NativeTheme* theme) override; | 65 void OnNativeThemeChanged(const ui::NativeTheme* theme) override; |
| 66 void ViewHierarchyChanged( |
| 67 const ViewHierarchyChangedDetails& details) override; |
66 | 68 |
67 // ButtonListener: | 69 // ButtonListener: |
68 void ButtonPressed(Button* sender, const ui::Event& event) override; | 70 void ButtonPressed(Button* sender, const ui::Event& event) override; |
69 | 71 |
70 // Use bubble_border() and SetBubbleBorder(), not border() and SetBorder(). | 72 // Use bubble_border() and SetBubbleBorder(), not border() and SetBorder(). |
71 BubbleBorder* bubble_border() const { return bubble_border_; } | 73 BubbleBorder* bubble_border() const { return bubble_border_; } |
72 void SetBubbleBorder(std::unique_ptr<BubbleBorder> border); | 74 void SetBubbleBorder(std::unique_ptr<BubbleBorder> border); |
73 | 75 |
74 gfx::Insets content_margins() const { return content_margins_; } | 76 gfx::Insets content_margins() const { return content_margins_; } |
75 | 77 |
76 void SetFootnoteView(View* view); | 78 void SetFootnoteView(View* view); |
77 | 79 |
| 80 void RemoveFootnoteView(); |
| 81 |
78 // Given the size of the contents and the rect to point at, returns the bounds | 82 // Given the size of the contents and the rect to point at, returns the bounds |
79 // of the bubble window. The bubble's arrow location may change if the bubble | 83 // of the bubble window. The bubble's arrow location may change if the bubble |
80 // does not fit on the monitor and |adjust_if_offscreen| is true. | 84 // does not fit on the monitor and |adjust_if_offscreen| is true. |
81 gfx::Rect GetUpdatedWindowBounds(const gfx::Rect& anchor_rect, | 85 gfx::Rect GetUpdatedWindowBounds(const gfx::Rect& anchor_rect, |
82 const gfx::Size& client_size, | 86 const gfx::Size& client_size, |
83 bool adjust_if_offscreen); | 87 bool adjust_if_offscreen); |
84 | 88 |
85 bool close_button_clicked() const { return close_button_clicked_; } | 89 bool close_button_clicked() const { return close_button_clicked_; } |
86 | 90 |
87 Button* GetCloseButtonForTest() { return close_; } | 91 Button* GetCloseButtonForTest() { return close_; } |
88 | 92 |
89 protected: | 93 protected: |
90 // Returns the available screen bounds if the frame were to show in |rect|. | 94 // Returns the available screen bounds if the frame were to show in |rect|. |
91 virtual gfx::Rect GetAvailableScreenBounds(const gfx::Rect& rect) const; | 95 virtual gfx::Rect GetAvailableScreenBounds(const gfx::Rect& rect) const; |
92 | 96 |
93 bool IsCloseButtonVisible() const; | 97 bool IsCloseButtonVisible() const; |
94 gfx::Rect GetCloseButtonMirroredBounds() const; | 98 gfx::Rect GetCloseButtonMirroredBounds() const; |
95 | 99 |
96 private: | 100 private: |
97 FRIEND_TEST_ALL_PREFIXES(BubbleFrameViewTest, GetBoundsForClientView); | 101 FRIEND_TEST_ALL_PREFIXES(BubbleFrameViewTest, GetBoundsForClientView); |
| 102 FRIEND_TEST_ALL_PREFIXES(BubbleFrameViewTest, RemoveFootnoteView); |
98 FRIEND_TEST_ALL_PREFIXES(BubbleDelegateTest, CloseReasons); | 103 FRIEND_TEST_ALL_PREFIXES(BubbleDelegateTest, CloseReasons); |
99 FRIEND_TEST_ALL_PREFIXES(BubbleDialogDelegateTest, CloseMethods); | 104 FRIEND_TEST_ALL_PREFIXES(BubbleDialogDelegateTest, CloseMethods); |
100 | 105 |
101 // Mirrors the bubble's arrow location on the |vertical| or horizontal axis, | 106 // Mirrors the bubble's arrow location on the |vertical| or horizontal axis, |
102 // if the generated window bounds don't fit in the monitor bounds. | 107 // if the generated window bounds don't fit in the monitor bounds. |
103 void MirrorArrowIfOffScreen(bool vertical, | 108 void MirrorArrowIfOffScreen(bool vertical, |
104 const gfx::Rect& anchor_rect, | 109 const gfx::Rect& anchor_rect, |
105 const gfx::Size& client_size); | 110 const gfx::Size& client_size); |
106 | 111 |
107 // Adjust the bubble's arrow offsets if the generated window bounds don't fit | 112 // Adjust the bubble's arrow offsets if the generated window bounds don't fit |
(...skipping 23 matching lines...) Expand all Loading... |
131 | 136 |
132 // Whether the close button was clicked. | 137 // Whether the close button was clicked. |
133 bool close_button_clicked_; | 138 bool close_button_clicked_; |
134 | 139 |
135 DISALLOW_COPY_AND_ASSIGN(BubbleFrameView); | 140 DISALLOW_COPY_AND_ASSIGN(BubbleFrameView); |
136 }; | 141 }; |
137 | 142 |
138 } // namespace views | 143 } // namespace views |
139 | 144 |
140 #endif // UI_VIEWS_BUBBLE_BUBBLE_FRAME_VIEW_H_ | 145 #endif // UI_VIEWS_BUBBLE_BUBBLE_FRAME_VIEW_H_ |
OLD | NEW |