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

Side by Side Diff: chrome/browser/ui/views/browser_action_view.cc

Issue 12529012: Context menu on views must show on mouse down for non-WIN. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: patch Created 7 years, 8 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 | Annotate | Revision Log
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/browser_action_view.h" 5 #include "chrome/browser/ui/views/browser_action_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/extension_action.h" 9 #include "chrome/browser/extensions/extension_action.h"
10 #include "chrome/browser/extensions/extension_action_manager.h" 10 #include "chrome/browser/extensions/extension_action_manager.h"
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 // to us. 307 // to us.
308 return false; 308 return false;
309 } 309 }
310 310
311 bool BrowserActionButton::OnMousePressed(const ui::MouseEvent& event) { 311 bool BrowserActionButton::OnMousePressed(const ui::MouseEvent& event) {
312 if (!event.IsRightMouseButton()) { 312 if (!event.IsRightMouseButton()) {
313 return IsPopup() ? MenuButton::OnMousePressed(event) : 313 return IsPopup() ? MenuButton::OnMousePressed(event) :
314 TextButton::OnMousePressed(event); 314 TextButton::OnMousePressed(event);
315 } 315 }
316 316
317 // See comments in MenuButton::Activate() as to why this is needed. 317 if (!views::View::ShouldShowContextMenuOnMousePress()) {
318 SetMouseHandler(NULL); 318 // See comments in MenuButton::Activate() as to why this is needed.
319 SetMouseHandler(NULL);
319 320
320 ShowContextMenu(gfx::Point(), true); 321 ShowContextMenu(gfx::Point(), true);
322 }
321 return false; 323 return false;
322 } 324 }
323 325
324 void BrowserActionButton::OnMouseReleased(const ui::MouseEvent& event) { 326 void BrowserActionButton::OnMouseReleased(const ui::MouseEvent& event) {
325 if (IsPopup() || context_menu_) { 327 if (IsPopup() || context_menu_) {
326 // TODO(erikkay) this never actually gets called (probably because of the 328 // TODO(erikkay) this never actually gets called (probably because of the
327 // loss of focus). 329 // loss of focus).
328 MenuButton::OnMouseReleased(event); 330 MenuButton::OnMouseReleased(event);
329 } else { 331 } else {
330 TextButton::OnMouseReleased(event); 332 TextButton::OnMouseReleased(event);
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 404
403 extensions::Command browser_action_command; 405 extensions::Command browser_action_command;
404 if (!only_if_active || !command_service->GetBrowserActionCommand( 406 if (!only_if_active || !command_service->GetBrowserActionCommand(
405 extension_->id(), 407 extension_->id(),
406 extensions::CommandService::ACTIVE_ONLY, 408 extensions::CommandService::ACTIVE_ONLY,
407 &browser_action_command, 409 &browser_action_command,
408 NULL)) { 410 NULL)) {
409 GetFocusManager()->UnregisterAccelerator(*keybinding_.get(), this); 411 GetFocusManager()->UnregisterAccelerator(*keybinding_.get(), this);
410 } 412 }
411 } 413 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/bookmarks/bookmark_bar_view_test.cc ('k') | ui/views/controls/menu/menu_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698