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

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

Issue 13565004: Revert 192525 "Context menu on views must show on mouse down for..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: 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 if (!views::View::ShouldShowContextMenuOnMousePress()) { 317 // See comments in MenuButton::Activate() as to why this is needed.
318 // See comments in MenuButton::Activate() as to why this is needed. 318 SetMouseHandler(NULL);
319 SetMouseHandler(NULL);
320 319
321 ShowContextMenu(gfx::Point(), true); 320 ShowContextMenu(gfx::Point(), true);
322 }
323 return false; 321 return false;
324 } 322 }
325 323
326 void BrowserActionButton::OnMouseReleased(const ui::MouseEvent& event) { 324 void BrowserActionButton::OnMouseReleased(const ui::MouseEvent& event) {
327 if (IsPopup() || context_menu_) { 325 if (IsPopup() || context_menu_) {
328 // TODO(erikkay) this never actually gets called (probably because of the 326 // TODO(erikkay) this never actually gets called (probably because of the
329 // loss of focus). 327 // loss of focus).
330 MenuButton::OnMouseReleased(event); 328 MenuButton::OnMouseReleased(event);
331 } else { 329 } else {
332 TextButton::OnMouseReleased(event); 330 TextButton::OnMouseReleased(event);
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 402
405 extensions::Command browser_action_command; 403 extensions::Command browser_action_command;
406 if (!only_if_active || !command_service->GetBrowserActionCommand( 404 if (!only_if_active || !command_service->GetBrowserActionCommand(
407 extension_->id(), 405 extension_->id(),
408 extensions::CommandService::ACTIVE_ONLY, 406 extensions::CommandService::ACTIVE_ONLY,
409 &browser_action_command, 407 &browser_action_command,
410 NULL)) { 408 NULL)) {
411 GetFocusManager()->UnregisterAccelerator(*keybinding_.get(), this); 409 GetFocusManager()->UnregisterAccelerator(*keybinding_.get(), this);
412 } 410 }
413 } 411 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698