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

Unified 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 side-by-side diff with in-line comments
Download patch
« 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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/bubble/bubble_frame_view.h
diff --git a/ui/views/bubble/bubble_frame_view.h b/ui/views/bubble/bubble_frame_view.h
index 5a8661d3f7e6e4fd3a6308b7cd2119d61ecd0f1a..e824eae6ba2591e23310fb2b2635ece23dc5a0be 100644
--- a/ui/views/bubble/bubble_frame_view.h
+++ b/ui/views/bubble/bubble_frame_view.h
@@ -7,6 +7,7 @@
#pragma once
#include "base/gtest_prod_util.h"
+#include "third_party/skia/include/core/SkColor.h"
#include "ui/views/bubble/bubble_border.h"
#include "ui/views/window/non_client_view.h"
@@ -19,10 +20,7 @@ class BorderContentsView;
////////////////////////////////////////////////////////////////////////////////
class VIEWS_EXPORT BubbleFrameView : public NonClientFrameView {
public:
- BubbleFrameView(BubbleBorder::ArrowLocation location,
- const gfx::Size& client_size,
- SkColor color,
- bool allow_bubble_offscreen);
+ BubbleFrameView(BubbleBorder::ArrowLocation arrow_location, SkColor color);
virtual ~BubbleFrameView();
// NonClientFrameView overrides:
@@ -38,19 +36,36 @@ class VIEWS_EXPORT BubbleFrameView : public NonClientFrameView {
// View overrides:
virtual gfx::Size GetPreferredSize() OVERRIDE;
- // Accessor for bubble border inside border contents.
- BubbleBorder* bubble_border() const;
+ BubbleBorder* bubble_border() const { return bubble_border_; }
- gfx::Rect GetWindowBoundsForAnchorAndClientSize(
- const gfx::Rect& anchor,
- const gfx::Size& client_size) const;
+ gfx::Insets content_margins() const { return content_margins_; }
+
+ // Given the size of the contents and the rect to point at, returns the bounds
+ // of the bubble window. The bubble's arrow location may change if the bubble
+ // does not fit on the monitor and |try_mirroring_arrow| is true.
+ gfx::Rect GetUpdatedWindowBounds(const gfx::Rect& anchor_rect,
+ gfx::Size client_size,
+ bool try_mirroring_arrow);
+
+ protected:
+ // Returns the bounds for the monitor showing the specified |rect|.
+ // This function is virtual to support testing environments.
+ virtual gfx::Rect GetMonitorBounds(const gfx::Rect& rect);
private:
- FRIEND_TEST_ALL_PREFIXES(BubbleFrameViewBasicTest, GetBoundsForClientView);
+ FRIEND_TEST_ALL_PREFIXES(BubbleFrameViewTest, GetBoundsForClientView);
+
+ // Mirrors the bubble's arrow location on the |vertical| or horizontal axis,
+ // if the generated window bounds don't fit in the monitor bounds.
+ void MirrorArrowIfOffScreen(bool vertical,
+ const gfx::Rect& anchor_rect,
+ const gfx::Size& client_size);
+
+ // The bubble border.
+ BubbleBorder* bubble_border_;
- BorderContentsView* border_contents_;
- BubbleBorder::ArrowLocation location_;
- bool allow_bubble_offscreen_;
+ // Margins between the content and the inside of the border, in pixels.
+ gfx::Insets content_margins_;
DISALLOW_COPY_AND_ASSIGN(BubbleFrameView);
};
« 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