summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authormirandac@chromium.org <mirandac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-27 21:36:20 +0000
committermirandac@chromium.org <mirandac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-27 21:36:20 +0000
commit3a6a3b65dff7f8c4544fe9ad0fbf600a3779633e (patch)
treef87a0c29399d8cdc832acbcf89fb5ef641ddef4e /chrome
parentee8d226ec025c66f948973e1f46b79871df1de94 (diff)
downloadchromium_src-3a6a3b65dff7f8c4544fe9ad0fbf600a3779633e.zip
chromium_src-3a6a3b65dff7f8c4544fe9ad0fbf600a3779633e.tar.gz
chromium_src-3a6a3b65dff7f8c4544fe9ad0fbf600a3779633e.tar.bz2
This fixes the problem of the status bubble obscuring the download shelf.
BUG= http://crbug.com/6590 TEST=Cause the download shelf to appear by initiating a download. Hover over a link in the extreme lower left corner of the browser window. The status bubble should avoid your mouse by moving to the right, instead of moving down and obscuring the download shelf. Review URL: http://codereview.chromium.org/113671 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17025 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/browser.cc4
-rw-r--r--chrome/browser/browser.h1
-rw-r--r--chrome/browser/cocoa/status_bubble_mac.h1
-rw-r--r--chrome/browser/cocoa/status_bubble_mac.mm4
-rw-r--r--chrome/browser/gtk/status_bubble_gtk.h5
-rw-r--r--chrome/browser/status_bubble.h5
-rw-r--r--chrome/browser/tab_contents/tab_contents.cc3
-rw-r--r--chrome/browser/tab_contents/tab_contents_delegate.h3
-rw-r--r--chrome/browser/views/status_bubble_views.cc14
-rw-r--r--chrome/browser/views/status_bubble_views.h4
10 files changed, 41 insertions, 3 deletions
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc
index 1cc6f0b..b3b539a 100644
--- a/chrome/browser/browser.cc
+++ b/chrome/browser/browser.cc
@@ -1911,6 +1911,10 @@ void Browser::UpdateTargetURL(TabContents* source, const GURL& url) {
}
}
+void Browser::UpdateDownloadShelfVisibility(bool visible) {
+ GetStatusBubble()->UpdateDownloadShelfVisibility(visible);
+}
+
void Browser::ContentsZoomChange(bool zoom_in) {
ExecuteCommand(zoom_in ? IDC_ZOOM_PLUS : IDC_ZOOM_MINUS);
}
diff --git a/chrome/browser/browser.h b/chrome/browser/browser.h
index 9b21861..ad74df5 100644
--- a/chrome/browser/browser.h
+++ b/chrome/browser/browser.h
@@ -481,6 +481,7 @@ class Browser : public TabStripModelDelegate,
// is the mouse leaving the view.
virtual void ContentsMouseEvent(TabContents* source, bool motion);
virtual void UpdateTargetURL(TabContents* source, const GURL& url);
+ virtual void UpdateDownloadShelfVisibility(bool visible);
virtual void ContentsZoomChange(bool zoom_in);
virtual bool IsApplication() const;
diff --git a/chrome/browser/cocoa/status_bubble_mac.h b/chrome/browser/cocoa/status_bubble_mac.h
index bbba43f..b6843c0 100644
--- a/chrome/browser/cocoa/status_bubble_mac.h
+++ b/chrome/browser/cocoa/status_bubble_mac.h
@@ -24,6 +24,7 @@ class StatusBubbleMac : public StatusBubble {
virtual void SetURL(const GURL& url, const std::wstring& languages);
virtual void Hide();
virtual void MouseMoved();
+ virtual void UpdateDownloadShelfVisibility(bool visible);
private:
friend class StatusBubbleMacTest;
diff --git a/chrome/browser/cocoa/status_bubble_mac.mm b/chrome/browser/cocoa/status_bubble_mac.mm
index eeb82d1..160b086 100644
--- a/chrome/browser/cocoa/status_bubble_mac.mm
+++ b/chrome/browser/cocoa/status_bubble_mac.mm
@@ -188,6 +188,10 @@ void StatusBubbleMac::MouseMoved() {
}
}
+void StatusBubbleMac::UpdateDownloadShelfVisibility(bool visible) {
+ NOTIMPLEMENTED();
+}
+
void StatusBubbleMac::Create() {
if (window_)
return;
diff --git a/chrome/browser/gtk/status_bubble_gtk.h b/chrome/browser/gtk/status_bubble_gtk.h
index eb37041..e4fb4c3 100644
--- a/chrome/browser/gtk/status_bubble_gtk.h
+++ b/chrome/browser/gtk/status_bubble_gtk.h
@@ -31,6 +31,11 @@ class StatusBubbleGtk : public StatusBubble {
virtual void Hide();
virtual void MouseMoved();
+ // Called when the download shelf becomes visible or invisible.
+ // This is used by to ensure that the status bubble does not obscure
+ // the download shelf, when it is visible.
+ virtual void UpdateDownloadShelfVisibility(bool visible) { }
+
void SetStatus(const std::string& status_utf8);
// Notification from our parent GtkFixed about its size. |allocation| is the
diff --git a/chrome/browser/status_bubble.h b/chrome/browser/status_bubble.h
index 3f58b9c..f5ecda4 100644
--- a/chrome/browser/status_bubble.h
+++ b/chrome/browser/status_bubble.h
@@ -39,6 +39,11 @@ class StatusBubble {
// mouse. This may be windows specific pain due to the way messages are
// processed for child HWNDs.
virtual void MouseMoved() = 0;
+
+ // Called when the download shelf becomes visible or invisible.
+ // This is used by to ensure that the status bubble does not obscure
+ // the download shelf, when it is visible.
+ virtual void UpdateDownloadShelfVisibility(bool visible) = 0;
};
#endif // #ifndef CHROME_BROWSER_STATUS_BUBBLE_H_
diff --git a/chrome/browser/tab_contents/tab_contents.cc b/chrome/browser/tab_contents/tab_contents.cc
index 1c6f892..0b27087 100644
--- a/chrome/browser/tab_contents/tab_contents.cc
+++ b/chrome/browser/tab_contents/tab_contents.cc
@@ -931,6 +931,9 @@ void TabContents::SetDownloadShelfVisible(bool visible) {
shelf_visible_ = visible;
NotifyNavigationStateChanged(INVALIDATE_TAB);
+
+ if (delegate())
+ delegate()->UpdateDownloadShelfVisibility(visible);
}
// SetShelfVisible can force-close the shelf, so make sure we lay out
diff --git a/chrome/browser/tab_contents/tab_contents_delegate.h b/chrome/browser/tab_contents/tab_contents_delegate.h
index e937fec..a67355e 100644
--- a/chrome/browser/tab_contents/tab_contents_delegate.h
+++ b/chrome/browser/tab_contents/tab_contents_delegate.h
@@ -89,6 +89,9 @@ class TabContentsDelegate {
// Notification that the target URL has changed
virtual void UpdateTargetURL(TabContents* source, const GURL& url) = 0;
+ // Notification that the download shelf visibility state has been toggled.
+ virtual void UpdateDownloadShelfVisibility(bool visible) { }
+
// Notification that there was a mouse event
virtual void ContentsMouseEvent(TabContents* source, bool motion) { }
diff --git a/chrome/browser/views/status_bubble_views.cc b/chrome/browser/views/status_bubble_views.cc
index e3c2ef2..3af8195 100644
--- a/chrome/browser/views/status_bubble_views.cc
+++ b/chrome/browser/views/status_bubble_views.cc
@@ -458,7 +458,8 @@ StatusBubbleViews::StatusBubbleViews(views::Widget* frame)
popup_(NULL),
opacity_(0),
frame_(frame),
- view_(NULL) {
+ view_(NULL),
+ download_shelf_is_visible_(false) {
}
StatusBubbleViews::~StatusBubbleViews() {
@@ -554,6 +555,10 @@ void StatusBubbleViews::MouseMoved() {
}
}
+void StatusBubbleViews::UpdateDownloadShelfVisibility(bool visible) {
+ download_shelf_is_visible_ = visible;
+}
+
void StatusBubbleViews::AvoidMouse() {
// Our status bubble is located in screen coordinates, so we should get
// those rather than attempting to reverse decode the web contents
@@ -606,7 +611,8 @@ void StatusBubbleViews::AvoidMouse() {
view_->SetStyle(StatusView::STYLE_STANDARD);
}
- // Check if the bubble sticks out from the monitor.
+ // Check if the bubble sticks out from the monitor or will obscure
+ // download shelf.
#if defined(OS_WIN)
MONITORINFO monitor_info;
monitor_info.cbSize = sizeof(monitor_info);
@@ -619,7 +625,9 @@ void StatusBubbleViews::AvoidMouse() {
#endif
const int bubble_bottom_y = top_left.y() + position_.y() + size_.height();
- if (bubble_bottom_y + offset > monitor_rect.height()) {
+ if (bubble_bottom_y + offset > monitor_rect.height() ||
+ (download_shelf_is_visible_ &&
+ view_->GetStyle() == StatusView::STYLE_FLOATING)) {
// The offset is still too large. Move the bubble to the right and reset
// Y offset_ to zero.
view_->SetStyle(StatusView::STYLE_STANDARD_RIGHT);
diff --git a/chrome/browser/views/status_bubble_views.h b/chrome/browser/views/status_bubble_views.h
index 5a94bb2..0dc90b0 100644
--- a/chrome/browser/views/status_bubble_views.h
+++ b/chrome/browser/views/status_bubble_views.h
@@ -38,6 +38,7 @@ class StatusBubbleViews : public StatusBubble {
virtual void SetURL(const GURL& url, const std::wstring& languages);
virtual void Hide();
virtual void MouseMoved();
+ virtual void UpdateDownloadShelfVisibility(bool visible);
private:
class StatusView;
@@ -70,6 +71,9 @@ class StatusBubbleViews : public StatusBubble {
views::Widget* frame_;
StatusView* view_;
+ // If the download shelf is visible, do not obscure it.
+ bool download_shelf_is_visible_;
+
DISALLOW_COPY_AND_ASSIGN(StatusBubbleViews);
};