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/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 | 77 |
78 void SetTitlebarExtraView(View* view); | 78 void SetTitlebarExtraView(View* view); |
79 | 79 |
80 // Given the size of the contents and the rect to point at, returns the bounds | 80 // Given the size of the contents and the rect to point at, returns the bounds |
81 // of the bubble window. The bubble's arrow location may change if the bubble | 81 // of the bubble window. The bubble's arrow location may change if the bubble |
82 // does not fit on the monitor and |adjust_if_offscreen| is true. | 82 // does not fit on the monitor and |adjust_if_offscreen| is true. |
83 gfx::Rect GetUpdatedWindowBounds(const gfx::Rect& anchor_rect, | 83 gfx::Rect GetUpdatedWindowBounds(const gfx::Rect& anchor_rect, |
84 gfx::Size client_size, | 84 gfx::Size client_size, |
85 bool adjust_if_offscreen); | 85 bool adjust_if_offscreen); |
86 | 86 |
87 bool close_button_clicked() const { return close_button_clicked_; } | |
88 | |
89 protected: | 87 protected: |
90 // Returns the available screen bounds if the frame were to show in |rect|. | 88 // Returns the available screen bounds if the frame were to show in |rect|. |
91 virtual gfx::Rect GetAvailableScreenBounds(const gfx::Rect& rect) const; | 89 virtual gfx::Rect GetAvailableScreenBounds(const gfx::Rect& rect) const; |
92 | 90 |
93 bool IsCloseButtonVisible() const; | 91 bool IsCloseButtonVisible() const; |
94 gfx::Rect GetCloseButtonMirroredBounds() const; | 92 gfx::Rect GetCloseButtonMirroredBounds() const; |
95 | 93 |
96 private: | 94 private: |
97 FRIEND_TEST_ALL_PREFIXES(BubbleFrameViewTest, GetBoundsForClientView); | 95 FRIEND_TEST_ALL_PREFIXES(BubbleFrameViewTest, GetBoundsForClientView); |
98 FRIEND_TEST_ALL_PREFIXES(BubbleDelegateTest, CloseReasons); | |
99 | 96 |
100 // Mirrors the bubble's arrow location on the |vertical| or horizontal axis, | 97 // Mirrors the bubble's arrow location on the |vertical| or horizontal axis, |
101 // if the generated window bounds don't fit in the monitor bounds. | 98 // if the generated window bounds don't fit in the monitor bounds. |
102 void MirrorArrowIfOffScreen(bool vertical, | 99 void MirrorArrowIfOffScreen(bool vertical, |
103 const gfx::Rect& anchor_rect, | 100 const gfx::Rect& anchor_rect, |
104 const gfx::Size& client_size); | 101 const gfx::Size& client_size); |
105 | 102 |
106 // Adjust the bubble's arrow offsets if the generated window bounds don't fit | 103 // Adjust the bubble's arrow offsets if the generated window bounds don't fit |
107 // in the monitor bounds. | 104 // in the monitor bounds. |
108 void OffsetArrowIfOffScreen(const gfx::Rect& anchor_rect, | 105 void OffsetArrowIfOffScreen(const gfx::Rect& anchor_rect, |
(...skipping 10 matching lines...) Expand all Loading... |
119 | 116 |
120 // The optional title icon, title, and (x) close button. | 117 // The optional title icon, title, and (x) close button. |
121 views::ImageView* title_icon_; | 118 views::ImageView* title_icon_; |
122 Label* title_; | 119 Label* title_; |
123 LabelButton* close_; | 120 LabelButton* close_; |
124 | 121 |
125 // When supplied, this view is placed in the titlebar between the title and | 122 // When supplied, this view is placed in the titlebar between the title and |
126 // (x) close button. | 123 // (x) close button. |
127 View* titlebar_extra_view_; | 124 View* titlebar_extra_view_; |
128 | 125 |
129 // Whether the close button was clicked. | |
130 bool close_button_clicked_; | |
131 | |
132 DISALLOW_COPY_AND_ASSIGN(BubbleFrameView); | 126 DISALLOW_COPY_AND_ASSIGN(BubbleFrameView); |
133 }; | 127 }; |
134 | 128 |
135 } // namespace views | 129 } // namespace views |
136 | 130 |
137 #endif // UI_VIEWS_BUBBLE_BUBBLE_FRAME_VIEW_H_ | 131 #endif // UI_VIEWS_BUBBLE_BUBBLE_FRAME_VIEW_H_ |
OLD | NEW |