| 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/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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |