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/page_action_image_view.h" | 5 #include "chrome/browser/ui/views/location_bar/page_action_image_view.h" |
6 | 6 |
7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "chrome/browser/extensions/api/commands/command_service.h" | 8 #include "chrome/browser/extensions/api/commands/command_service.h" |
9 #include "chrome/browser/extensions/api/commands/command_service_factory.h" | 9 #include "chrome/browser/extensions/api/commands/command_service_factory.h" |
10 #include "chrome/browser/extensions/extension_context_menu_model.h" | 10 #include "chrome/browser/extensions/extension_context_menu_model.h" |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 ShowPopupWithURL(ExtensionInfoUI::GetURL(page_action_->extension_id())); | 155 ShowPopupWithURL(ExtensionInfoUI::GetURL(page_action_->extension_id())); |
156 break; | 156 break; |
157 } | 157 } |
158 } | 158 } |
159 | 159 |
160 void PageActionImageView::GetAccessibleState(ui::AccessibleViewState* state) { | 160 void PageActionImageView::GetAccessibleState(ui::AccessibleViewState* state) { |
161 state->role = ui::AccessibilityTypes::ROLE_PUSHBUTTON; | 161 state->role = ui::AccessibilityTypes::ROLE_PUSHBUTTON; |
162 state->name = UTF8ToUTF16(tooltip_); | 162 state->name = UTF8ToUTF16(tooltip_); |
163 } | 163 } |
164 | 164 |
165 bool PageActionImageView::OnMousePressed(const views::MouseEvent& event) { | 165 bool PageActionImageView::OnMousePressed(const ui::MouseEvent& event) { |
166 // We want to show the bubble on mouse release; that is the standard behavior | 166 // We want to show the bubble on mouse release; that is the standard behavior |
167 // for buttons. (Also, triggering on mouse press causes bugs like | 167 // for buttons. (Also, triggering on mouse press causes bugs like |
168 // http://crbug.com/33155.) | 168 // http://crbug.com/33155.) |
169 return true; | 169 return true; |
170 } | 170 } |
171 | 171 |
172 void PageActionImageView::OnMouseReleased(const views::MouseEvent& event) { | 172 void PageActionImageView::OnMouseReleased(const ui::MouseEvent& event) { |
173 if (!HitTestPoint(event.location())) | 173 if (!HitTestPoint(event.location())) |
174 return; | 174 return; |
175 | 175 |
176 int button = -1; | 176 int button = -1; |
177 if (event.IsLeftMouseButton()) { | 177 if (event.IsLeftMouseButton()) { |
178 button = 1; | 178 button = 1; |
179 } else if (event.IsMiddleMouseButton()) { | 179 } else if (event.IsMiddleMouseButton()) { |
180 button = 2; | 180 button = 2; |
181 } else if (event.IsRightMouseButton()) { | 181 } else if (event.IsRightMouseButton()) { |
182 // Don't show a menu here, its handled in View::ProcessMouseReleased. We | 182 // Don't show a menu here, its handled in View::ProcessMouseReleased. We |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 views::BubbleBorder::TOP_LEFT : views::BubbleBorder::TOP_RIGHT; | 314 views::BubbleBorder::TOP_LEFT : views::BubbleBorder::TOP_RIGHT; |
315 | 315 |
316 popup_ = ExtensionPopup::ShowPopup(popup_url, browser_, this, arrow_location); | 316 popup_ = ExtensionPopup::ShowPopup(popup_url, browser_, this, arrow_location); |
317 popup_->GetWidget()->AddObserver(this); | 317 popup_->GetWidget()->AddObserver(this); |
318 } | 318 } |
319 | 319 |
320 void PageActionImageView::HidePopup() { | 320 void PageActionImageView::HidePopup() { |
321 if (popup_) | 321 if (popup_) |
322 popup_->GetWidget()->Close(); | 322 popup_->GetWidget()->Close(); |
323 } | 323 } |
OLD | NEW |