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

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.
sky 2013/04/04 20:36:04 Why are you removing this?
varunjain 2013/04/04 21:02:08 Now that we are showing context menu on mouse pres
318 SetMouseHandler(NULL);
319
320 ShowContextMenu(gfx::Point(), true);
321 return false; 317 return false;
322 } 318 }
323 319
324 void BrowserActionButton::OnMouseReleased(const ui::MouseEvent& event) { 320 void BrowserActionButton::OnMouseReleased(const ui::MouseEvent& event) {
325 if (IsPopup() || context_menu_) { 321 if (IsPopup() || context_menu_) {
326 // TODO(erikkay) this never actually gets called (probably because of the 322 // TODO(erikkay) this never actually gets called (probably because of the
327 // loss of focus). 323 // loss of focus).
328 MenuButton::OnMouseReleased(event); 324 MenuButton::OnMouseReleased(event);
329 } else { 325 } else {
330 TextButton::OnMouseReleased(event); 326 TextButton::OnMouseReleased(event);
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 398
403 extensions::Command browser_action_command; 399 extensions::Command browser_action_command;
404 if (!only_if_active || !command_service->GetBrowserActionCommand( 400 if (!only_if_active || !command_service->GetBrowserActionCommand(
405 extension_->id(), 401 extension_->id(),
406 extensions::CommandService::ACTIVE_ONLY, 402 extensions::CommandService::ACTIVE_ONLY,
407 &browser_action_command, 403 &browser_action_command,
408 NULL)) { 404 NULL)) {
409 GetFocusManager()->UnregisterAccelerator(*keybinding_.get(), this); 405 GetFocusManager()->UnregisterAccelerator(*keybinding_.get(), this);
410 } 406 }
411 } 407 }
OLDNEW
« no previous file with comments | « no previous file | ui/views/controls/menu/menu_controller.h » ('j') | ui/views/controls/menu/menu_controller.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698