| 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 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 470 } | 471 } |
| 471 | 472 |
| 472 void ExtensionHost::StartDragging(const WebDropData& drop_data, | 473 void ExtensionHost::StartDragging(const WebDropData& drop_data, |
| 473 WebDragOperationsMask operation_mask) { | 474 WebDragOperationsMask operation_mask) { |
| 474 } | 475 } |
| 475 | 476 |
| 476 void ExtensionHost::UpdateDragCursor(WebDragOperation operation) { | 477 void ExtensionHost::UpdateDragCursor(WebDragOperation operation) { |
| 477 } | 478 } |
| 478 | 479 |
| 479 void ExtensionHost::GotFocus() { | 480 void ExtensionHost::GotFocus() { |
| 481 #if defined(TOOLKIT_VIEWS) |
| 482 // Request focus so that the FocusManager has a focused view and can perform |
| 483 // normally its key event processing (so that it lets tab key events go to the |
| 484 // renderer). |
| 485 view()->RequestFocus(); |
| 486 #else |
| 487 // TODO(port) |
| 488 #endif |
| 480 } | 489 } |
| 481 | 490 |
| 482 void ExtensionHost::TakeFocus(bool reverse) { | 491 void ExtensionHost::TakeFocus(bool reverse) { |
| 483 } | 492 } |
| 484 | 493 |
| 485 bool ExtensionHost::IsReservedAccelerator(const NativeWebKeyboardEvent& event) { | 494 bool ExtensionHost::IsReservedAccelerator(const NativeWebKeyboardEvent& event) { |
| 486 return false; | 495 return false; |
| 487 } | 496 } |
| 488 | 497 |
| 489 bool ExtensionHost::HandleKeyboardEvent(const NativeWebKeyboardEvent& event) { | 498 bool ExtensionHost::HandleKeyboardEvent(const NativeWebKeyboardEvent& event) { |
| 499 if (extension_host_type_ == ViewType::EXTENSION_POPUP && |
| 500 event.windowsKeyCode == base::VKEY_ESCAPE) { |
| 501 NotificationService::current()->Notify( |
| 502 NotificationType::EXTENSION_HOST_VIEW_SHOULD_CLOSE, |
| 503 Source<Profile>(profile_), |
| 504 Details<ExtensionHost>(this)); |
| 505 return true; |
| 506 } |
| 490 return false; | 507 return false; |
| 491 } | 508 } |
| 492 | 509 |
| 493 void ExtensionHost::HandleMouseEvent() { | 510 void ExtensionHost::HandleMouseEvent() { |
| 494 #if defined(OS_WIN) | 511 #if defined(OS_WIN) |
| 495 if (view_.get()) | 512 if (view_.get()) |
| 496 view_->HandleMouseEvent(); | 513 view_->HandleMouseEvent(); |
| 497 #endif | 514 #endif |
| 498 } | 515 } |
| 499 | 516 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 565 window_id = ExtensionTabUtil::GetWindowId( | 582 window_id = ExtensionTabUtil::GetWindowId( |
| 566 const_cast<ExtensionHost* >(this)->GetBrowser()); | 583 const_cast<ExtensionHost* >(this)->GetBrowser()); |
| 567 } else if (extension_host_type_ == ViewType::EXTENSION_BACKGROUND_PAGE) { | 584 } else if (extension_host_type_ == ViewType::EXTENSION_BACKGROUND_PAGE) { |
| 568 // Background page is not attached to any browser window, so pass -1. | 585 // Background page is not attached to any browser window, so pass -1. |
| 569 window_id = -1; | 586 window_id = -1; |
| 570 } else { | 587 } else { |
| 571 NOTREACHED(); | 588 NOTREACHED(); |
| 572 } | 589 } |
| 573 return window_id; | 590 return window_id; |
| 574 } | 591 } |
| OLD | NEW |