OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ui/views/location_bar/star_view.h" | 5 #include "chrome/browser/ui/views/location_bar/star_view.h" |
6 | 6 |
7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "chrome/app/chrome_command_ids.h" | 8 #include "chrome/app/chrome_command_ids.h" |
9 #include "chrome/browser/command_updater.h" | 9 #include "chrome/browser/command_updater.h" |
10 #include "chrome/browser/ui/view_ids.h" | 10 #include "chrome/browser/ui/view_ids.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 } | 44 } |
45 | 45 |
46 bool StarView::GetTooltipText(const gfx::Point& p, string16* tooltip) const { | 46 bool StarView::GetTooltipText(const gfx::Point& p, string16* tooltip) const { |
47 // Don't show tooltip to distract user if BookmarkBubbleView is showing. | 47 // Don't show tooltip to distract user if BookmarkBubbleView is showing. |
48 if (chrome::IsBookmarkBubbleViewShowing()) | 48 if (chrome::IsBookmarkBubbleViewShowing()) |
49 return false; | 49 return false; |
50 | 50 |
51 return views::ImageView::GetTooltipText(p, tooltip); | 51 return views::ImageView::GetTooltipText(p, tooltip); |
52 } | 52 } |
53 | 53 |
54 bool StarView::OnMousePressed(const views::MouseEvent& event) { | 54 bool StarView::OnMousePressed(const ui::MouseEvent& event) { |
55 // We want to show the bubble on mouse release; that is the standard behavior | 55 // We want to show the bubble on mouse release; that is the standard behavior |
56 // for buttons. | 56 // for buttons. |
57 return true; | 57 return true; |
58 } | 58 } |
59 | 59 |
60 void StarView::OnMouseReleased(const views::MouseEvent& event) { | 60 void StarView::OnMouseReleased(const ui::MouseEvent& event) { |
61 if (event.IsOnlyLeftMouseButton() && HitTestPoint(event.location())) | 61 if (event.IsOnlyLeftMouseButton() && HitTestPoint(event.location())) |
62 command_updater_->ExecuteCommand(IDC_BOOKMARK_PAGE); | 62 command_updater_->ExecuteCommand(IDC_BOOKMARK_PAGE); |
63 } | 63 } |
64 | 64 |
65 ui::GestureStatus StarView::OnGestureEvent(const views::GestureEvent& event) { | 65 ui::GestureStatus StarView::OnGestureEvent(const views::GestureEvent& event) { |
66 if (event.type() == ui::ET_GESTURE_TAP) { | 66 if (event.type() == ui::ET_GESTURE_TAP) { |
67 command_updater_->ExecuteCommand(IDC_BOOKMARK_PAGE); | 67 command_updater_->ExecuteCommand(IDC_BOOKMARK_PAGE); |
68 return ui::GESTURE_STATUS_CONSUMED; | 68 return ui::GESTURE_STATUS_CONSUMED; |
69 } | 69 } |
70 return ui::GESTURE_STATUS_UNKNOWN; | 70 return ui::GESTURE_STATUS_UNKNOWN; |
71 } | 71 } |
72 | 72 |
73 bool StarView::OnKeyPressed(const ui::KeyEvent& event) { | 73 bool StarView::OnKeyPressed(const ui::KeyEvent& event) { |
74 if (event.key_code() == ui::VKEY_SPACE || | 74 if (event.key_code() == ui::VKEY_SPACE || |
75 event.key_code() == ui::VKEY_RETURN) { | 75 event.key_code() == ui::VKEY_RETURN) { |
76 command_updater_->ExecuteCommand(IDC_BOOKMARK_PAGE); | 76 command_updater_->ExecuteCommand(IDC_BOOKMARK_PAGE); |
77 return true; | 77 return true; |
78 } | 78 } |
79 return false; | 79 return false; |
80 } | 80 } |
OLD | NEW |