OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/views/toolbar_star_toggle.h" | 5 #include "chrome/browser/views/toolbar_star_toggle.h" |
6 | 6 |
7 #include "chrome/app/theme/theme_resources.h" | 7 #include "chrome/app/theme/theme_resources.h" |
8 #include "chrome/browser/bookmarks/bookmark_model.h" | 8 #include "chrome/browser/bookmarks/bookmark_model.h" |
9 #include "chrome/browser/browser.h" | 9 #include "chrome/browser/browser.h" |
10 #include "chrome/browser/views/bookmark_bubble_view.h" | 10 #include "chrome/browser/views/bookmark_bubble_view.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 ignore_click_(false), | 30 ignore_click_(false), |
31 is_bubble_showing_(false) { | 31 is_bubble_showing_(false) { |
32 } | 32 } |
33 | 33 |
34 void ToolbarStarToggle::ShowStarBubble(const GURL& url, bool newly_bookmarked) { | 34 void ToolbarStarToggle::ShowStarBubble(const GURL& url, bool newly_bookmarked) { |
35 if (is_bubble_showing_) { | 35 if (is_bubble_showing_) { |
36 // Don't show if we're already showing the bubble. | 36 // Don't show if we're already showing the bubble. |
37 return; | 37 return; |
38 } | 38 } |
39 | 39 |
40 CPoint star_location(0, 0); | 40 gfx::Point star_location; |
41 ChromeViews::View::ConvertPointToScreen(this, &star_location); | 41 ChromeViews::View::ConvertPointToScreen(this, &star_location); |
42 // Shift the x location by 1 as visually the center of the star appears 1 | 42 // Shift the x location by 1 as visually the center of the star appears 1 |
43 // pixel to the right. By doing this bubble arrow points to the center | 43 // pixel to the right. By doing this bubble arrow points to the center |
44 // of the star. | 44 // of the star. |
45 gfx::Rect star_bounds(star_location.x + 1, star_location.y, width(), | 45 gfx::Rect star_bounds(star_location.x() + 1, star_location.y(), width(), |
46 height()); | 46 height()); |
47 BookmarkBubbleView::Show(host_->browser()->GetTopLevelHWND(), star_bounds, | 47 BookmarkBubbleView::Show(host_->browser()->GetTopLevelHWND(), star_bounds, |
48 this, host_->profile(), url, newly_bookmarked); | 48 this, host_->profile(), url, newly_bookmarked); |
49 is_bubble_showing_ = true; | 49 is_bubble_showing_ = true; |
50 } | 50 } |
51 | 51 |
52 bool ToolbarStarToggle::OnMousePressed(const ChromeViews::MouseEvent& e) { | 52 bool ToolbarStarToggle::OnMousePressed(const ChromeViews::MouseEvent& e) { |
53 ignore_click_ = ((TimeTicks::Now() - bubble_closed_time_).InMilliseconds() < | 53 ignore_click_ = ((TimeTicks::Now() - bubble_closed_time_).InMilliseconds() < |
54 kDisallowClickMS); | 54 kDisallowClickMS); |
55 return ToggleButton::OnMousePressed(e); | 55 return ToggleButton::OnMousePressed(e); |
(...skipping 26 matching lines...) Expand all Loading... |
82 void ToolbarStarToggle::InfoBubbleClosing(InfoBubble* info_bubble) { | 82 void ToolbarStarToggle::InfoBubbleClosing(InfoBubble* info_bubble) { |
83 is_bubble_showing_ = false; | 83 is_bubble_showing_ = false; |
84 SchedulePaint(); | 84 SchedulePaint(); |
85 bubble_closed_time_ = TimeTicks::Now(); | 85 bubble_closed_time_ = TimeTicks::Now(); |
86 } | 86 } |
87 | 87 |
88 bool ToolbarStarToggle::CloseOnEscape() { | 88 bool ToolbarStarToggle::CloseOnEscape() { |
89 return true; | 89 return true; |
90 } | 90 } |
91 | 91 |
OLD | NEW |