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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 return views::ImageView::GetTooltipText(p, tooltip); | 50 return views::ImageView::GetTooltipText(p, tooltip); |
51 } | 51 } |
52 | 52 |
53 bool StarView::OnMousePressed(const views::MouseEvent& event) { | 53 bool StarView::OnMousePressed(const views::MouseEvent& event) { |
54 // We want to show the bubble on mouse release; that is the standard behavior | 54 // We want to show the bubble on mouse release; that is the standard behavior |
55 // for buttons. | 55 // for buttons. |
56 return true; | 56 return true; |
57 } | 57 } |
58 | 58 |
59 void StarView::OnMouseReleased(const views::MouseEvent& event) { | 59 void StarView::OnMouseReleased(const views::MouseEvent& event) { |
60 if (event.IsOnlyLeftMouseButton() && HitTest(event.location())) | 60 if (event.IsOnlyLeftMouseButton() && HitTestPoint(event.location())) |
61 command_updater_->ExecuteCommand(IDC_BOOKMARK_PAGE); | 61 command_updater_->ExecuteCommand(IDC_BOOKMARK_PAGE); |
62 } | 62 } |
63 | 63 |
64 ui::GestureStatus StarView::OnGestureEvent(const views::GestureEvent& event) { | 64 ui::GestureStatus StarView::OnGestureEvent(const views::GestureEvent& event) { |
65 if (event.type() == ui::ET_GESTURE_TAP) { | 65 if (event.type() == ui::ET_GESTURE_TAP) { |
66 command_updater_->ExecuteCommand(IDC_BOOKMARK_PAGE); | 66 command_updater_->ExecuteCommand(IDC_BOOKMARK_PAGE); |
67 return ui::GESTURE_STATUS_CONSUMED; | 67 return ui::GESTURE_STATUS_CONSUMED; |
68 } | 68 } |
69 return ui::GESTURE_STATUS_UNKNOWN; | 69 return ui::GESTURE_STATUS_UNKNOWN; |
70 } | 70 } |
71 | 71 |
72 bool StarView::OnKeyPressed(const views::KeyEvent& event) { | 72 bool StarView::OnKeyPressed(const views::KeyEvent& event) { |
73 if (event.key_code() == ui::VKEY_SPACE || | 73 if (event.key_code() == ui::VKEY_SPACE || |
74 event.key_code() == ui::VKEY_RETURN) { | 74 event.key_code() == ui::VKEY_RETURN) { |
75 command_updater_->ExecuteCommand(IDC_BOOKMARK_PAGE); | 75 command_updater_->ExecuteCommand(IDC_BOOKMARK_PAGE); |
76 return true; | 76 return true; |
77 } | 77 } |
78 return false; | 78 return false; |
79 } | 79 } |
OLD | NEW |