Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(43)

Side by Side Diff: chrome/browser/ui/views/location_bar/page_action_image_view.cc

Issue 10827198: Change View::HitTest to View::HitTestRect (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fixed errors reported by trybots Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 } 162 }
163 163
164 bool PageActionImageView::OnMousePressed(const views::MouseEvent& event) { 164 bool PageActionImageView::OnMousePressed(const views::MouseEvent& event) {
165 // We want to show the bubble on mouse release; that is the standard behavior 165 // We want to show the bubble on mouse release; that is the standard behavior
166 // for buttons. (Also, triggering on mouse press causes bugs like 166 // for buttons. (Also, triggering on mouse press causes bugs like
167 // http://crbug.com/33155.) 167 // http://crbug.com/33155.)
168 return true; 168 return true;
169 } 169 }
170 170
171 void PageActionImageView::OnMouseReleased(const views::MouseEvent& event) { 171 void PageActionImageView::OnMouseReleased(const views::MouseEvent& event) {
172 if (!HitTest(event.location())) 172 if (!HitTestPoint(event.location()))
173 return; 173 return;
174 174
175 int button = -1; 175 int button = -1;
176 if (event.IsLeftMouseButton()) { 176 if (event.IsLeftMouseButton()) {
177 button = 1; 177 button = 1;
178 } else if (event.IsMiddleMouseButton()) { 178 } else if (event.IsMiddleMouseButton()) {
179 button = 2; 179 button = 2;
180 } else if (event.IsRightMouseButton()) { 180 } else if (event.IsRightMouseButton()) {
181 // Don't show a menu here, its handled in View::ProcessMouseReleased. We 181 // Don't show a menu here, its handled in View::ProcessMouseReleased. We
182 // show the context menu by way of being the ContextMenuController. 182 // show the context menu by way of being the ContextMenuController.
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698