| 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 |
| 87 protected: | 89 protected: |
| 88 // Returns the available screen bounds if the frame were to show in |rect|. | 90 // Returns the available screen bounds if the frame were to show in |rect|. |
| 89 virtual gfx::Rect GetAvailableScreenBounds(const gfx::Rect& rect) const; | 91 virtual gfx::Rect GetAvailableScreenBounds(const gfx::Rect& rect) const; |
| 90 | 92 |
| 91 bool IsCloseButtonVisible() const; | 93 bool IsCloseButtonVisible() const; |
| 92 gfx::Rect GetCloseButtonMirroredBounds() const; | 94 gfx::Rect GetCloseButtonMirroredBounds() const; |
| 93 | 95 |
| 94 private: | 96 private: |
| 95 FRIEND_TEST_ALL_PREFIXES(BubbleFrameViewTest, GetBoundsForClientView); | 97 FRIEND_TEST_ALL_PREFIXES(BubbleFrameViewTest, GetBoundsForClientView); |
| 98 FRIEND_TEST_ALL_PREFIXES(BubbleDelegateTest, CloseReasons); |
| 96 | 99 |
| 97 // Mirrors the bubble's arrow location on the |vertical| or horizontal axis, | 100 // Mirrors the bubble's arrow location on the |vertical| or horizontal axis, |
| 98 // if the generated window bounds don't fit in the monitor bounds. | 101 // if the generated window bounds don't fit in the monitor bounds. |
| 99 void MirrorArrowIfOffScreen(bool vertical, | 102 void MirrorArrowIfOffScreen(bool vertical, |
| 100 const gfx::Rect& anchor_rect, | 103 const gfx::Rect& anchor_rect, |
| 101 const gfx::Size& client_size); | 104 const gfx::Size& client_size); |
| 102 | 105 |
| 103 // Adjust the bubble's arrow offsets if the generated window bounds don't fit | 106 // Adjust the bubble's arrow offsets if the generated window bounds don't fit |
| 104 // in the monitor bounds. | 107 // in the monitor bounds. |
| 105 void OffsetArrowIfOffScreen(const gfx::Rect& anchor_rect, | 108 void OffsetArrowIfOffScreen(const gfx::Rect& anchor_rect, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 116 | 119 |
| 117 // The optional title icon, title, and (x) close button. | 120 // The optional title icon, title, and (x) close button. |
| 118 views::ImageView* title_icon_; | 121 views::ImageView* title_icon_; |
| 119 Label* title_; | 122 Label* title_; |
| 120 LabelButton* close_; | 123 LabelButton* close_; |
| 121 | 124 |
| 122 // When supplied, this view is placed in the titlebar between the title and | 125 // When supplied, this view is placed in the titlebar between the title and |
| 123 // (x) close button. | 126 // (x) close button. |
| 124 View* titlebar_extra_view_; | 127 View* titlebar_extra_view_; |
| 125 | 128 |
| 129 // Whether the close button was clicked. |
| 130 bool close_button_clicked_; |
| 131 |
| 126 DISALLOW_COPY_AND_ASSIGN(BubbleFrameView); | 132 DISALLOW_COPY_AND_ASSIGN(BubbleFrameView); |
| 127 }; | 133 }; |
| 128 | 134 |
| 129 } // namespace views | 135 } // namespace views |
| 130 | 136 |
| 131 #endif // UI_VIEWS_BUBBLE_BUBBLE_FRAME_VIEW_H_ | 137 #endif // UI_VIEWS_BUBBLE_BUBBLE_FRAME_VIEW_H_ |
| OLD | NEW |