| 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/strings/utf_string_conversions.h" | 7 #include "base/strings/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/extension_action.h" | 9 #include "chrome/browser/extensions/extension_action.h" |
| 10 #include "chrome/browser/extensions/extension_action_icon_factory.h" | 10 #include "chrome/browser/extensions/extension_action_icon_factory.h" |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 } | 117 } |
| 118 | 118 |
| 119 bool PageActionImageView::OnMousePressed(const ui::MouseEvent& event) { | 119 bool PageActionImageView::OnMousePressed(const ui::MouseEvent& event) { |
| 120 // We want to show the bubble on mouse release; that is the standard behavior | 120 // We want to show the bubble on mouse release; that is the standard behavior |
| 121 // for buttons. (Also, triggering on mouse press causes bugs like | 121 // for buttons. (Also, triggering on mouse press causes bugs like |
| 122 // http://crbug.com/33155.) | 122 // http://crbug.com/33155.) |
| 123 return true; | 123 return true; |
| 124 } | 124 } |
| 125 | 125 |
| 126 void PageActionImageView::OnMouseReleased(const ui::MouseEvent& event) { | 126 void PageActionImageView::OnMouseReleased(const ui::MouseEvent& event) { |
| 127 if (!HitTestPoint(event.location())) | 127 if (!HitTestPoint(gfx::ToFlooredPoint(event.location()))) |
| 128 return; | 128 return; |
| 129 | 129 |
| 130 if (event.IsRightMouseButton()) { | 130 if (event.IsRightMouseButton()) { |
| 131 // Don't show a menu here, its handled in View::ProcessMouseReleased. We | 131 // Don't show a menu here, its handled in View::ProcessMouseReleased. We |
| 132 // show the context menu by way of being the ContextMenuController. | 132 // show the context menu by way of being the ContextMenuController. |
| 133 return; | 133 return; |
| 134 } | 134 } |
| 135 | 135 |
| 136 ExecuteAction(ExtensionPopup::SHOW); | 136 ExecuteAction(ExtensionPopup::SHOW); |
| 137 } | 137 } |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 | 250 |
| 251 popup_ = ExtensionPopup::ShowPopup(popup_url, browser_, this, arrow, | 251 popup_ = ExtensionPopup::ShowPopup(popup_url, browser_, this, arrow, |
| 252 show_action); | 252 show_action); |
| 253 popup_->GetWidget()->AddObserver(this); | 253 popup_->GetWidget()->AddObserver(this); |
| 254 } | 254 } |
| 255 | 255 |
| 256 void PageActionImageView::HidePopup() { | 256 void PageActionImageView::HidePopup() { |
| 257 if (popup_) | 257 if (popup_) |
| 258 popup_->GetWidget()->Close(); | 258 popup_->GetWidget()->Close(); |
| 259 } | 259 } |
| OLD | NEW |