| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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/extensions/extension_host.h" | 5 #include "chrome/browser/extensions/extension_host.h" |
| 6 | 6 |
| 7 #include <list> | 7 #include <list> |
| 8 | 8 |
| 9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
| 10 #include "app/resource_bundle.h" | 10 #include "app/resource_bundle.h" |
| 11 #include "base/keyboard_codes.h" |
| 11 #include "base/message_loop.h" | 12 #include "base/message_loop.h" |
| 12 #include "base/singleton.h" | 13 #include "base/singleton.h" |
| 13 #include "base/string_util.h" | 14 #include "base/string_util.h" |
| 14 #include "chrome/browser/browser.h" | 15 #include "chrome/browser/browser.h" |
| 15 #include "chrome/browser/browser_list.h" | 16 #include "chrome/browser/browser_list.h" |
| 16 #include "chrome/browser/browser_theme_provider.h" | 17 #include "chrome/browser/browser_theme_provider.h" |
| 17 #include "chrome/browser/browsing_instance.h" | 18 #include "chrome/browser/browsing_instance.h" |
| 18 #include "chrome/browser/debugger/devtools_manager.h" | 19 #include "chrome/browser/debugger/devtools_manager.h" |
| 19 #include "chrome/browser/dom_ui/dom_ui_factory.h" | 20 #include "chrome/browser/dom_ui/dom_ui_factory.h" |
| 20 #include "chrome/browser/extensions/extension_message_service.h" | 21 #include "chrome/browser/extensions/extension_message_service.h" |
| (...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 530 } | 531 } |
| 531 | 532 |
| 532 void ExtensionHost::StartDragging(const WebDropData& drop_data, | 533 void ExtensionHost::StartDragging(const WebDropData& drop_data, |
| 533 WebDragOperationsMask operation_mask) { | 534 WebDragOperationsMask operation_mask) { |
| 534 } | 535 } |
| 535 | 536 |
| 536 void ExtensionHost::UpdateDragCursor(WebDragOperation operation) { | 537 void ExtensionHost::UpdateDragCursor(WebDragOperation operation) { |
| 537 } | 538 } |
| 538 | 539 |
| 539 void ExtensionHost::GotFocus() { | 540 void ExtensionHost::GotFocus() { |
| 541 #if defined(TOOLKIT_VIEWS) |
| 542 // Request focus so that the FocusManager has a focused view and can perform |
| 543 // normally its key event processing (so that it lets tab key events go to the |
| 544 // renderer). |
| 545 view()->RequestFocus(); |
| 546 #else |
| 547 // TODO(port) |
| 548 #endif |
| 540 } | 549 } |
| 541 | 550 |
| 542 void ExtensionHost::TakeFocus(bool reverse) { | 551 void ExtensionHost::TakeFocus(bool reverse) { |
| 543 } | 552 } |
| 544 | 553 |
| 545 bool ExtensionHost::IsReservedAccelerator(const NativeWebKeyboardEvent& event) { | 554 bool ExtensionHost::IsReservedAccelerator(const NativeWebKeyboardEvent& event) { |
| 546 return false; | 555 return false; |
| 547 } | 556 } |
| 548 | 557 |
| 549 bool ExtensionHost::HandleKeyboardEvent(const NativeWebKeyboardEvent& event) { | 558 bool ExtensionHost::HandleKeyboardEvent(const NativeWebKeyboardEvent& event) { |
| 559 if (extension_host_type_ == ViewType::EXTENSION_POPUP && |
| 560 event.windowsKeyCode == base::VKEY_ESCAPE) { |
| 561 NotificationService::current()->Notify( |
| 562 NotificationType::EXTENSION_HOST_VIEW_SHOULD_CLOSE, |
| 563 Source<Profile>(profile_), |
| 564 Details<ExtensionHost>(this)); |
| 565 return true; |
| 566 } |
| 550 return false; | 567 return false; |
| 551 } | 568 } |
| 552 | 569 |
| 553 void ExtensionHost::HandleMouseEvent() { | 570 void ExtensionHost::HandleMouseEvent() { |
| 554 #if defined(OS_WIN) | 571 #if defined(OS_WIN) |
| 555 if (view_.get()) | 572 if (view_.get()) |
| 556 view_->HandleMouseEvent(); | 573 view_->HandleMouseEvent(); |
| 557 #endif | 574 #endif |
| 558 } | 575 } |
| 559 | 576 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 625 window_id = ExtensionTabUtil::GetWindowId( | 642 window_id = ExtensionTabUtil::GetWindowId( |
| 626 const_cast<ExtensionHost* >(this)->GetBrowser()); | 643 const_cast<ExtensionHost* >(this)->GetBrowser()); |
| 627 } else if (extension_host_type_ == ViewType::EXTENSION_BACKGROUND_PAGE) { | 644 } else if (extension_host_type_ == ViewType::EXTENSION_BACKGROUND_PAGE) { |
| 628 // Background page is not attached to any browser window, so pass -1. | 645 // Background page is not attached to any browser window, so pass -1. |
| 629 window_id = -1; | 646 window_id = -1; |
| 630 } else { | 647 } else { |
| 631 NOTREACHED(); | 648 NOTREACHED(); |
| 632 } | 649 } |
| 633 return window_id; | 650 return window_id; |
| 634 } | 651 } |
| OLD | NEW |