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/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 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 // TODO(erikkay): Run a nested modal loop while the mouse is down to | 318 // TODO(erikkay): Run a nested modal loop while the mouse is down to |
319 // enable menu-like drag-select behavior. | 319 // enable menu-like drag-select behavior. |
320 | 320 |
321 // The return value of this method is returned via OnMousePressed. | 321 // The return value of this method is returned via OnMousePressed. |
322 // We need to return false here since we're handing off focus to another | 322 // We need to return false here since we're handing off focus to another |
323 // widget/view, and true will grab it right back and try to send events | 323 // widget/view, and true will grab it right back and try to send events |
324 // to us. | 324 // to us. |
325 return false; | 325 return false; |
326 } | 326 } |
327 | 327 |
328 bool BrowserActionButton::OnMousePressed(const views::MouseEvent& event) { | 328 bool BrowserActionButton::OnMousePressed(const ui::MouseEvent& event) { |
329 if (!event.IsRightMouseButton()) { | 329 if (!event.IsRightMouseButton()) { |
330 return IsPopup() ? MenuButton::OnMousePressed(event) | 330 return IsPopup() ? MenuButton::OnMousePressed(event) |
331 : TextButton::OnMousePressed(event); | 331 : TextButton::OnMousePressed(event); |
332 } | 332 } |
333 | 333 |
334 // See comments in MenuButton::Activate() as to why this is needed. | 334 // See comments in MenuButton::Activate() as to why this is needed. |
335 SetMouseHandler(NULL); | 335 SetMouseHandler(NULL); |
336 | 336 |
337 ShowContextMenu(gfx::Point(), true); | 337 ShowContextMenu(gfx::Point(), true); |
338 return false; | 338 return false; |
339 } | 339 } |
340 | 340 |
341 void BrowserActionButton::OnMouseReleased(const views::MouseEvent& event) { | 341 void BrowserActionButton::OnMouseReleased(const ui::MouseEvent& event) { |
342 if (IsPopup() || context_menu_) { | 342 if (IsPopup() || context_menu_) { |
343 // TODO(erikkay) this never actually gets called (probably because of the | 343 // TODO(erikkay) this never actually gets called (probably because of the |
344 // loss of focus). | 344 // loss of focus). |
345 MenuButton::OnMouseReleased(event); | 345 MenuButton::OnMouseReleased(event); |
346 } else { | 346 } else { |
347 TextButton::OnMouseReleased(event); | 347 TextButton::OnMouseReleased(event); |
348 } | 348 } |
349 } | 349 } |
350 | 350 |
351 void BrowserActionButton::OnMouseExited(const views::MouseEvent& event) { | 351 void BrowserActionButton::OnMouseExited(const ui::MouseEvent& event) { |
352 if (IsPopup() || context_menu_) | 352 if (IsPopup() || context_menu_) |
353 MenuButton::OnMouseExited(event); | 353 MenuButton::OnMouseExited(event); |
354 else | 354 else |
355 TextButton::OnMouseExited(event); | 355 TextButton::OnMouseExited(event); |
356 } | 356 } |
357 | 357 |
358 bool BrowserActionButton::OnKeyReleased(const ui::KeyEvent& event) { | 358 bool BrowserActionButton::OnKeyReleased(const ui::KeyEvent& event) { |
359 return IsPopup() ? MenuButton::OnKeyReleased(event) | 359 return IsPopup() ? MenuButton::OnKeyReleased(event) |
360 : TextButton::OnKeyReleased(event); | 360 : TextButton::OnKeyReleased(event); |
361 } | 361 } |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 | 408 |
409 extensions::Command browser_action_command; | 409 extensions::Command browser_action_command; |
410 if (!only_if_active || !command_service->GetBrowserActionCommand( | 410 if (!only_if_active || !command_service->GetBrowserActionCommand( |
411 extension_->id(), | 411 extension_->id(), |
412 extensions::CommandService::ACTIVE_ONLY, | 412 extensions::CommandService::ACTIVE_ONLY, |
413 &browser_action_command, | 413 &browser_action_command, |
414 NULL)) { | 414 NULL)) { |
415 GetFocusManager()->UnregisterAccelerator(*keybinding_.get(), this); | 415 GetFocusManager()->UnregisterAccelerator(*keybinding_.get(), this); |
416 } | 416 } |
417 } | 417 } |
OLD | NEW |