summaryrefslogtreecommitdiffstats
path: root/chrome/browser/views/info_bubble.h
diff options
context:
space:
mode:
authorjcivelli@chromium.org <jcivelli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-12 18:57:45 +0000
committerjcivelli@chromium.org <jcivelli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-12 18:57:45 +0000
commit034fbbd8fb6271e4193f97bdda129791c0ba6b72 (patch)
treee8136fc902b6f52a2e8386bfcf4f6c1db275ad1c /chrome/browser/views/info_bubble.h
parentdd3c3e68d29e797ca96323ee51b9b41438f7c9ba (diff)
downloadchromium_src-034fbbd8fb6271e4193f97bdda129791c0ba6b72.zip
chromium_src-034fbbd8fb6271e4193f97bdda129791c0ba6b72.tar.gz
chromium_src-034fbbd8fb6271e4193f97bdda129791c0ba6b72.tar.bz2
This CL makes the InfoBubble not change the arrow when parts of it
is offscreen if it makes it even more offscreen. BUG=None TEST=Open the app launcher on ChromeOS. It should display correctly. Review URL: http://codereview.chromium.org/2025008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@47053 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views/info_bubble.h')
-rw-r--r--chrome/browser/views/info_bubble.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/chrome/browser/views/info_bubble.h b/chrome/browser/views/info_bubble.h
index f6d774d..6dad21f 100644
--- a/chrome/browser/views/info_bubble.h
+++ b/chrome/browser/views/info_bubble.h
@@ -63,6 +63,10 @@ class BorderContents : public views::View {
protected:
virtual ~BorderContents() { }
+ // Returns the bounds for the monitor showing the specified |rect|.
+ // Overriden in unit-tests.
+ virtual gfx::Rect GetMonitorBounds(const gfx::Rect& rect);
+
// Margins between the contents and the inside of the border, in pixels.
static const int kLeftMargin = 6;
static const int kTopMargin = 6;
@@ -75,6 +79,28 @@ class BorderContents : public views::View {
// Overridden from View:
virtual void Paint(gfx::Canvas* canvas);
+ // Changes |arrow_location| to its mirrored version, vertically if |vertical|
+ // is true, horizontally otherwise, if |window_bounds| don't fit in
+ // |monitor_bounds|.
+ void MirrorArrowIfOffScreen(bool vertical,
+ const gfx::Rect& position_relative_to,
+ const gfx::Rect& monitor_bounds,
+ const gfx::Size& local_contents_size,
+ BubbleBorder::ArrowLocation* arrow_location,
+ gfx::Rect* window_bounds);
+
+ // Computes how much |window_bounds| is off-screen of the monitor bounds
+ // |monitor_bounds| and puts the values in |offscreen_insets|.
+ // Returns false if |window_bounds| is actually contained in |monitor_bounds|,
+ // in which case |offscreen_insets| is not modified.
+ static bool ComputeOffScreenInsets(const gfx::Rect& monitor_bounds,
+ const gfx::Rect& window_bounds,
+ gfx::Insets* offscreen_insets);
+
+ // Convenience methods that returns the height of |insets| if |vertical| is
+ // true, its width otherwise.
+ static int GetInsetsLength(const gfx::Insets& insets, bool vertical);
+
DISALLOW_COPY_AND_ASSIGN(BorderContents);
};