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

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

Issue 8870003: Merge BorderContentsView into BubbleFrameView; simplify. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync and merge. Created 9 years 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
« no previous file with comments | « ui/views/bubble/bubble_delegate_unittest.cc ('k') | ui/views/bubble/bubble_frame_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #pragma once 7 #pragma once
8 8
9 #include "base/gtest_prod_util.h" 9 #include "base/gtest_prod_util.h"
10 #include "third_party/skia/include/core/SkColor.h"
10 #include "ui/views/bubble/bubble_border.h" 11 #include "ui/views/bubble/bubble_border.h"
11 #include "ui/views/window/non_client_view.h" 12 #include "ui/views/window/non_client_view.h"
12 13
13 namespace views { 14 namespace views {
14 15
15 class BorderContentsView; 16 class BorderContentsView;
16 17
17 // BubbleFrameView to render BubbleBorder. 18 // BubbleFrameView to render BubbleBorder.
18 // 19 //
19 //////////////////////////////////////////////////////////////////////////////// 20 ////////////////////////////////////////////////////////////////////////////////
20 class VIEWS_EXPORT BubbleFrameView : public NonClientFrameView { 21 class VIEWS_EXPORT BubbleFrameView : public NonClientFrameView {
21 public: 22 public:
22 BubbleFrameView(BubbleBorder::ArrowLocation location, 23 BubbleFrameView(BubbleBorder::ArrowLocation arrow_location, SkColor color);
23 const gfx::Size& client_size,
24 SkColor color,
25 bool allow_bubble_offscreen);
26 virtual ~BubbleFrameView(); 24 virtual ~BubbleFrameView();
27 25
28 // NonClientFrameView overrides: 26 // NonClientFrameView overrides:
29 virtual gfx::Rect GetBoundsForClientView() const OVERRIDE; 27 virtual gfx::Rect GetBoundsForClientView() const OVERRIDE;
30 virtual gfx::Rect GetWindowBoundsForClientBounds( 28 virtual gfx::Rect GetWindowBoundsForClientBounds(
31 const gfx::Rect& client_bounds) const OVERRIDE; 29 const gfx::Rect& client_bounds) const OVERRIDE;
32 virtual int NonClientHitTest(const gfx::Point& point) OVERRIDE; 30 virtual int NonClientHitTest(const gfx::Point& point) OVERRIDE;
33 virtual void GetWindowMask(const gfx::Size& size, 31 virtual void GetWindowMask(const gfx::Size& size,
34 gfx::Path* window_mask) OVERRIDE {} 32 gfx::Path* window_mask) OVERRIDE {}
35 virtual void ResetWindowControls() OVERRIDE {} 33 virtual void ResetWindowControls() OVERRIDE {}
36 virtual void UpdateWindowIcon() OVERRIDE {} 34 virtual void UpdateWindowIcon() OVERRIDE {}
37 35
38 // View overrides: 36 // View overrides:
39 virtual gfx::Size GetPreferredSize() OVERRIDE; 37 virtual gfx::Size GetPreferredSize() OVERRIDE;
40 38
41 // Accessor for bubble border inside border contents. 39 BubbleBorder* bubble_border() const { return bubble_border_; }
42 BubbleBorder* bubble_border() const;
43 40
44 gfx::Rect GetWindowBoundsForAnchorAndClientSize( 41 gfx::Insets content_margins() const { return content_margins_; }
45 const gfx::Rect& anchor, 42
46 const gfx::Size& client_size) const; 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
45 // does not fit on the monitor and |try_mirroring_arrow| is true.
46 gfx::Rect GetUpdatedWindowBounds(const gfx::Rect& anchor_rect,
47 gfx::Size client_size,
48 bool try_mirroring_arrow);
49
50 protected:
51 // Returns the bounds for the monitor showing the specified |rect|.
52 // This function is virtual to support testing environments.
53 virtual gfx::Rect GetMonitorBounds(const gfx::Rect& rect);
47 54
48 private: 55 private:
49 FRIEND_TEST_ALL_PREFIXES(BubbleFrameViewBasicTest, GetBoundsForClientView); 56 FRIEND_TEST_ALL_PREFIXES(BubbleFrameViewTest, GetBoundsForClientView);
50 57
51 BorderContentsView* border_contents_; 58 // Mirrors the bubble's arrow location on the |vertical| or horizontal axis,
52 BubbleBorder::ArrowLocation location_; 59 // if the generated window bounds don't fit in the monitor bounds.
53 bool allow_bubble_offscreen_; 60 void MirrorArrowIfOffScreen(bool vertical,
61 const gfx::Rect& anchor_rect,
62 const gfx::Size& client_size);
63
64 // The bubble border.
65 BubbleBorder* bubble_border_;
66
67 // Margins between the content and the inside of the border, in pixels.
68 gfx::Insets content_margins_;
54 69
55 DISALLOW_COPY_AND_ASSIGN(BubbleFrameView); 70 DISALLOW_COPY_AND_ASSIGN(BubbleFrameView);
56 }; 71 };
57 72
58 } // namespace views 73 } // namespace views
59 74
60 #endif // UI_VIEWS_BUBBLE_BUBBLE_FRAME_VIEW_H_ 75 #endif // UI_VIEWS_BUBBLE_BUBBLE_FRAME_VIEW_H_
OLDNEW
« no previous file with comments | « ui/views/bubble/bubble_delegate_unittest.cc ('k') | ui/views/bubble/bubble_frame_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698