diff options
author | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-18 22:26:53 +0000 |
---|---|---|
committer | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-18 22:26:53 +0000 |
commit | cb71491f6fd9eb062ecbce3df5ca543c77652d91 (patch) | |
tree | 2a2eba85ee8a57f207bbb3241f41e1b01c55c97f /chrome/browser/views/bookmark_bubble_view.cc | |
parent | 2c36d61f64d9383dc90576164e3f09b313e2f7a7 (diff) | |
download | chromium_src-cb71491f6fd9eb062ecbce3df5ca543c77652d91.zip chromium_src-cb71491f6fd9eb062ecbce3df5ca543c77652d91.tar.gz chromium_src-cb71491f6fd9eb062ecbce3df5ca543c77652d91.tar.bz2 |
Fix two problems with bookmarking and fullscreen mode:
* The bubble didn't close when toggling in/out of fullscreen mode. This was because we only ever closed on an activation change, rather than on a window move. Made the bubble close when the window moves. This required refactoring the bubble code to have a static instance; once I did that I also cleaned up the rest of the code a bit to not check if the bubble was already showing, and just let the bookmark bubble itself take care of this.
* The bubble positioning was wrong in fullscreen mode. This was because the toolbar layout was in turn wrong in fullscreen mode. Made the toolbars able to handle being 0-height.
BUG=534
TEST=Bookmark a page and hit F11. The bubble should disappear. Hit ctrl-D. The bubble should appear at the right spot, not floating in the middle of the screen. Hit F11 again. The bubble should disappear, and the toolbar button should be drawn undepressed.
Review URL: http://codereview.chromium.org/21479
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9982 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views/bookmark_bubble_view.cc')
-rw-r--r-- | chrome/browser/views/bookmark_bubble_view.cc | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/chrome/browser/views/bookmark_bubble_view.cc b/chrome/browser/views/bookmark_bubble_view.cc index cd6b9c9..890594d5 100644 --- a/chrome/browser/views/bookmark_bubble_view.cc +++ b/chrome/browser/views/bookmark_bubble_view.cc @@ -110,6 +110,8 @@ void BookmarkBubbleView::RecentlyUsedFoldersModel::RemoveNode( // BookmarkBubbleView --------------------------------------------------------- +BookmarkBubbleView* BookmarkBubbleView::bubble_ = NULL; + // static void BookmarkBubbleView::Show(HWND parent, const gfx::Rect& bounds, @@ -117,15 +119,27 @@ void BookmarkBubbleView::Show(HWND parent, Profile* profile, const GURL& url, bool newly_bookmarked) { - BookmarkBubbleView* view = new BookmarkBubbleView(delegate, profile, url, - newly_bookmarked); - InfoBubble::Show(parent, bounds, view, view); + if (IsShowing()) + return; + + bubble_ = new BookmarkBubbleView(delegate, profile, url, newly_bookmarked); + InfoBubble::Show(parent, bounds, bubble_, bubble_); GURL url_ptr(url); NotificationService::current()->Notify( NotificationType::BOOKMARK_BUBBLE_SHOWN, Source<Profile>(profile->GetOriginalProfile()), Details<GURL>(&url_ptr)); - view->BubbleShown(); + bubble_->BubbleShown(); +} + +// static +bool BookmarkBubbleView::IsShowing() { + return bubble_ != NULL; +} + +void BookmarkBubbleView::Hide() { + if (IsShowing()) + bubble_->Close(); } BookmarkBubbleView::~BookmarkBubbleView() { @@ -317,6 +331,11 @@ void BookmarkBubbleView::InfoBubbleClosing(InfoBubble* info_bubble, apply_edits_ = false; } + // We have to reset |bubble_| here, not in our destructor, because we'll be + // destroyed asynchronously and the shown state will be checked before then. + DCHECK(bubble_ == this); + bubble_ = NULL; + if (delegate_) delegate_->InfoBubbleClosing(info_bubble, closed_by_escape); NotificationService::current()->Notify( |