Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(348)

Side by Side Diff: ui/views/bubble/bubble_frame_view.h

Issue 10905311: Consolidate bubble border code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix nit in #2 and arrow interior color Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 24 matching lines...) Expand all
35 35
36 // View overrides: 36 // View overrides:
37 virtual gfx::Size GetPreferredSize() OVERRIDE; 37 virtual gfx::Size GetPreferredSize() OVERRIDE;
38 38
39 BubbleBorder* bubble_border() const { return bubble_border_; } 39 BubbleBorder* bubble_border() const { return bubble_border_; }
40 40
41 gfx::Insets content_margins() const { return content_margins_; } 41 gfx::Insets content_margins() const { return content_margins_; }
42 42
43 // Given the size of the contents and the rect to point at, returns the bounds 43 // Given the size of the contents and the rect to point at, returns the bounds
44 // of the bubble window. The bubble's arrow location may change if the bubble 44 // of the bubble window. The bubble's arrow location may change if the bubble
45 // does not fit on the monitor and |try_mirroring_arrow| is true. 45 // does not fit on the monitor and |try_fit_bubble| is true.
46 gfx::Rect GetUpdatedWindowBounds(const gfx::Rect& anchor_rect, 46 gfx::Rect GetUpdatedWindowBounds(const gfx::Rect& anchor_rect,
47 gfx::Size client_size, 47 gfx::Size client_size,
48 bool try_mirroring_arrow); 48 bool try_fit_bubble);
49 49
50 void SetBubbleBorder(BubbleBorder* border); 50 void SetBubbleBorder(BubbleBorder* border);
51 51
52 protected: 52 protected:
53 // Returns the bounds for the monitor showing the specified |rect|. 53 // Returns the bounds for the monitor showing the specified |rect|.
54 // This function is virtual to support testing environments. 54 // This function is virtual to support testing environments.
55 virtual gfx::Rect GetMonitorBounds(const gfx::Rect& rect); 55 virtual gfx::Rect GetMonitorBounds(const gfx::Rect& rect);
56 56
57 private: 57 private:
58 FRIEND_TEST_ALL_PREFIXES(BubbleFrameViewTest, GetBoundsForClientView); 58 FRIEND_TEST_ALL_PREFIXES(BubbleFrameViewTest, GetBoundsForClientView);
59 59
60 // Mirrors the bubble's arrow location on the |vertical| or horizontal axis, 60 // Mirrors the bubble's arrow location on the |vertical| or horizontal axis,
61 // if the generated window bounds don't fit in the monitor bounds. 61 // if the generated window bounds don't fit in the monitor bounds.
62 void MirrorArrowIfOffScreen(bool vertical, 62 void MirrorArrowIfOffScreen(bool vertical,
63 const gfx::Rect& anchor_rect, 63 const gfx::Rect& anchor_rect,
64 const gfx::Size& client_size); 64 const gfx::Size& client_size);
65 65
66 // Move arrow (by setting its offset) to make bubble fit in the monitor
msw 2012/09/18 19:33:42 nit: grammar; consider: "Adjust the bubble's arrow
xiyuan 2012/09/19 18:20:09 Done.
67 // bounds.
68 void OffsetArrowIfOffScreen(const gfx::Rect& anchor_rect,
69 const gfx::Size& client_size);
70
66 // The bubble border. 71 // The bubble border.
67 BubbleBorder* bubble_border_; 72 BubbleBorder* bubble_border_;
68 73
69 // Margins between the content and the inside of the border, in pixels. 74 // Margins between the content and the inside of the border, in pixels.
70 gfx::Insets content_margins_; 75 gfx::Insets content_margins_;
71 76
72 DISALLOW_COPY_AND_ASSIGN(BubbleFrameView); 77 DISALLOW_COPY_AND_ASSIGN(BubbleFrameView);
73 }; 78 };
74 79
75 } // namespace views 80 } // namespace views
76 81
77 #endif // UI_VIEWS_BUBBLE_BUBBLE_FRAME_VIEW_H_ 82 #endif // UI_VIEWS_BUBBLE_BUBBLE_FRAME_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698