Chromium Code Reviews| 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 SetCloseCallback(base::Closure c) {callback_before_close_ = c;} | |
|
Alexei Svitkine (slow)
2014/07/02 15:07:26
This should use hacker_style (i.e. set_before_clos
yao
2014/07/07 17:47:45
Done.
| |
| 84 | |
| 82 protected: | 85 protected: |
| 83 // Returns the available screen bounds if the frame were to show in |rect|. | 86 // Returns the available screen bounds if the frame were to show in |rect|. |
| 84 virtual gfx::Rect GetAvailableScreenBounds(const gfx::Rect& rect); | 87 virtual gfx::Rect GetAvailableScreenBounds(const gfx::Rect& rect); |
| 85 | 88 |
| 86 private: | 89 private: |
| 87 FRIEND_TEST_ALL_PREFIXES(BubbleFrameViewTest, GetBoundsForClientView); | 90 FRIEND_TEST_ALL_PREFIXES(BubbleFrameViewTest, GetBoundsForClientView); |
| 88 | 91 |
| 89 // Mirrors the bubble's arrow location on the |vertical| or horizontal axis, | 92 // 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. | 93 // if the generated window bounds don't fit in the monitor bounds. |
| 91 void MirrorArrowIfOffScreen(bool vertical, | 94 void MirrorArrowIfOffScreen(bool vertical, |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 107 gfx::Insets content_margins_; | 110 gfx::Insets content_margins_; |
| 108 | 111 |
| 109 // The optional title and (x) close button. | 112 // The optional title and (x) close button. |
| 110 Label* title_; | 113 Label* title_; |
| 111 LabelButton* close_; | 114 LabelButton* close_; |
| 112 | 115 |
| 113 // When supplied, this view is placed in the titlebar between the title and | 116 // When supplied, this view is placed in the titlebar between the title and |
| 114 // (x) close button. | 117 // (x) close button. |
| 115 View* titlebar_extra_view_; | 118 View* titlebar_extra_view_; |
| 116 | 119 |
| 120 // The callback function is executed before bubble is closed. It can be used | |
| 121 // to customize bubble's close behavior. | |
| 122 base::Closure callback_before_close_; | |
|
Alexei Svitkine (slow)
2014/07/02 15:07:26
Nit: Rename to before_close_callback_
yao
2014/07/07 17:47:45
Done.
| |
| 123 | |
| 117 DISALLOW_COPY_AND_ASSIGN(BubbleFrameView); | 124 DISALLOW_COPY_AND_ASSIGN(BubbleFrameView); |
| 118 }; | 125 }; |
| 119 | 126 |
| 120 } // namespace views | 127 } // namespace views |
| 121 | 128 |
| 122 #endif // UI_VIEWS_BUBBLE_BUBBLE_FRAME_VIEW_H_ | 129 #endif // UI_VIEWS_BUBBLE_BUBBLE_FRAME_VIEW_H_ |
| OLD | NEW |