summaryrefslogtreecommitdiffstats
path: root/chrome/browser/views/toolbar_star_toggle.cc
diff options
context:
space:
mode:
authorpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-18 22:26:53 +0000
committerpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-18 22:26:53 +0000
commitcb71491f6fd9eb062ecbce3df5ca543c77652d91 (patch)
tree2a2eba85ee8a57f207bbb3241f41e1b01c55c97f /chrome/browser/views/toolbar_star_toggle.cc
parent2c36d61f64d9383dc90576164e3f09b313e2f7a7 (diff)
downloadchromium_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/toolbar_star_toggle.cc')
-rw-r--r--chrome/browser/views/toolbar_star_toggle.cc14
1 files changed, 3 insertions, 11 deletions
diff --git a/chrome/browser/views/toolbar_star_toggle.cc b/chrome/browser/views/toolbar_star_toggle.cc
index e4a017f..420605c 100644
--- a/chrome/browser/views/toolbar_star_toggle.cc
+++ b/chrome/browser/views/toolbar_star_toggle.cc
@@ -29,16 +29,10 @@ static const int64 kDisallowClickMS = 40;
ToolbarStarToggle::ToolbarStarToggle(BrowserToolbarView* host)
: host_(host),
- ignore_click_(false),
- is_bubble_showing_(false) {
+ ignore_click_(false) {
}
void ToolbarStarToggle::ShowStarBubble(const GURL& url, bool newly_bookmarked) {
- if (is_bubble_showing_) {
- // Don't show if we're already showing the bubble.
- return;
- }
-
gfx::Point star_location;
views::View::ConvertPointToScreen(this, &star_location);
// Shift the x location by 1 as visually the center of the star appears 1
@@ -50,7 +44,6 @@ void ToolbarStarToggle::ShowStarBubble(const GURL& url, bool newly_bookmarked) {
reinterpret_cast<HWND>(host_->browser()->window()->GetNativeHandle());
BookmarkBubbleView::Show(parent_hwnd, star_bounds, this, host_->profile(),
url, newly_bookmarked);
- is_bubble_showing_ = true;
}
bool ToolbarStarToggle::OnMousePressed(const views::MouseEvent& e) {
@@ -71,12 +64,12 @@ void ToolbarStarToggle::OnDragDone() {
}
void ToolbarStarToggle::NotifyClick(int mouse_event_flags) {
- if (!ignore_click_ && !is_bubble_showing_)
+ if (!ignore_click_ && !BookmarkBubbleView::IsShowing())
ToggleButton::NotifyClick(mouse_event_flags);
}
SkBitmap ToolbarStarToggle::GetImageToPaint() {
- if (is_bubble_showing_) {
+ if (BookmarkBubbleView::IsShowing()) {
ResourceBundle &rb = ResourceBundle::GetSharedInstance();
return *rb.GetBitmapNamed(IDR_STARRED_P);
}
@@ -85,7 +78,6 @@ SkBitmap ToolbarStarToggle::GetImageToPaint() {
void ToolbarStarToggle::InfoBubbleClosing(InfoBubble* info_bubble,
bool closed_by_escape) {
- is_bubble_showing_ = false;
SchedulePaint();
bubble_closed_time_ = TimeTicks::Now();
}