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/callback.h" |
9 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
10 #include "base/gtest_prod_util.h" | 11 #include "base/gtest_prod_util.h" |
11 #include "ui/gfx/insets.h" | 12 #include "ui/gfx/insets.h" |
12 #include "ui/views/controls/button/button.h" | 13 #include "ui/views/controls/button/button.h" |
13 #include "ui/views/window/non_client_view.h" | 14 #include "ui/views/window/non_client_view.h" |
14 | 15 |
15 namespace gfx { | 16 namespace gfx { |
16 class FontList; | 17 class FontList; |
17 } | 18 } |
18 | 19 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 | 73 |
73 void SetTitlebarExtraView(View* view); | 74 void SetTitlebarExtraView(View* view); |
74 | 75 |
75 // Given the size of the contents and the rect to point at, returns the bounds | 76 // Given the size of the contents and the rect to point at, returns the bounds |
76 // of the bubble window. The bubble's arrow location may change if the bubble | 77 // of the bubble window. The bubble's arrow location may change if the bubble |
77 // does not fit on the monitor and |adjust_if_offscreen| is true. | 78 // does not fit on the monitor and |adjust_if_offscreen| is true. |
78 gfx::Rect GetUpdatedWindowBounds(const gfx::Rect& anchor_rect, | 79 gfx::Rect GetUpdatedWindowBounds(const gfx::Rect& anchor_rect, |
79 gfx::Size client_size, | 80 gfx::Size client_size, |
80 bool adjust_if_offscreen); | 81 bool adjust_if_offscreen); |
81 | 82 |
| 83 void set_before_close_callback(base::Closure c) { |
| 84 before_close_callback_ = c; |
| 85 } |
| 86 |
82 protected: | 87 protected: |
83 // 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|. |
84 virtual gfx::Rect GetAvailableScreenBounds(const gfx::Rect& rect); | 89 virtual gfx::Rect GetAvailableScreenBounds(const gfx::Rect& rect); |
85 | 90 |
86 private: | 91 private: |
87 FRIEND_TEST_ALL_PREFIXES(BubbleFrameViewTest, GetBoundsForClientView); | 92 FRIEND_TEST_ALL_PREFIXES(BubbleFrameViewTest, GetBoundsForClientView); |
88 | 93 |
89 // Mirrors the bubble's arrow location on the |vertical| or horizontal axis, | 94 // Mirrors the bubble's arrow location on the |vertical| or horizontal axis, |
90 // if the generated window bounds don't fit in the monitor bounds. | 95 // if the generated window bounds don't fit in the monitor bounds. |
91 void MirrorArrowIfOffScreen(bool vertical, | 96 void MirrorArrowIfOffScreen(bool vertical, |
(...skipping 15 matching lines...) Expand all Loading... |
107 gfx::Insets content_margins_; | 112 gfx::Insets content_margins_; |
108 | 113 |
109 // The optional title and (x) close button. | 114 // The optional title and (x) close button. |
110 Label* title_; | 115 Label* title_; |
111 LabelButton* close_; | 116 LabelButton* close_; |
112 | 117 |
113 // When supplied, this view is placed in the titlebar between the title and | 118 // When supplied, this view is placed in the titlebar between the title and |
114 // (x) close button. | 119 // (x) close button. |
115 View* titlebar_extra_view_; | 120 View* titlebar_extra_view_; |
116 | 121 |
| 122 // The callback function is executed before bubble is closed. It can be used |
| 123 // to customize bubble's close behavior. |
| 124 base::Closure before_close_callback_; |
| 125 |
117 DISALLOW_COPY_AND_ASSIGN(BubbleFrameView); | 126 DISALLOW_COPY_AND_ASSIGN(BubbleFrameView); |
118 }; | 127 }; |
119 | 128 |
120 } // namespace views | 129 } // namespace views |
121 | 130 |
122 #endif // UI_VIEWS_BUBBLE_BUBBLE_FRAME_VIEW_H_ | 131 #endif // UI_VIEWS_BUBBLE_BUBBLE_FRAME_VIEW_H_ |
OLD | NEW |