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" |
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
512 // renderer). | 512 // renderer). |
513 view()->RequestFocus(); | 513 view()->RequestFocus(); |
514 #else | 514 #else |
515 // TODO(port) | 515 // TODO(port) |
516 #endif | 516 #endif |
517 } | 517 } |
518 | 518 |
519 void ExtensionHost::TakeFocus(bool reverse) { | 519 void ExtensionHost::TakeFocus(bool reverse) { |
520 } | 520 } |
521 | 521 |
522 bool ExtensionHost::IsReservedAccelerator(const NativeWebKeyboardEvent& event) { | 522 bool ExtensionHost::PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event, |
| 523 bool* is_keyboard_shortcut) { |
| 524 if (extension_host_type_ == ViewType::EXTENSION_POPUP && |
| 525 event.windowsKeyCode == base::VKEY_ESCAPE) { |
| 526 DCHECK(is_keyboard_shortcut != NULL); |
| 527 *is_keyboard_shortcut = true; |
| 528 } |
523 return false; | 529 return false; |
524 } | 530 } |
525 | 531 |
526 bool ExtensionHost::HandleKeyboardEvent(const NativeWebKeyboardEvent& event) { | 532 void ExtensionHost::HandleKeyboardEvent(const NativeWebKeyboardEvent& event) { |
527 if (extension_host_type_ == ViewType::EXTENSION_POPUP && | 533 if (extension_host_type_ == ViewType::EXTENSION_POPUP && |
528 event.windowsKeyCode == base::VKEY_ESCAPE) { | 534 event.windowsKeyCode == base::VKEY_ESCAPE) { |
529 NotificationService::current()->Notify( | 535 NotificationService::current()->Notify( |
530 NotificationType::EXTENSION_HOST_VIEW_SHOULD_CLOSE, | 536 NotificationType::EXTENSION_HOST_VIEW_SHOULD_CLOSE, |
531 Source<Profile>(profile_), | 537 Source<Profile>(profile_), |
532 Details<ExtensionHost>(this)); | 538 Details<ExtensionHost>(this)); |
533 return true; | |
534 } | 539 } |
535 return false; | |
536 } | 540 } |
537 | 541 |
538 void ExtensionHost::HandleMouseEvent() { | 542 void ExtensionHost::HandleMouseEvent() { |
539 #if defined(OS_WIN) | 543 #if defined(OS_WIN) |
540 if (view_.get()) | 544 if (view_.get()) |
541 view_->HandleMouseEvent(); | 545 view_->HandleMouseEvent(); |
542 #endif | 546 #endif |
543 } | 547 } |
544 | 548 |
545 void ExtensionHost::HandleMouseLeave() { | 549 void ExtensionHost::HandleMouseLeave() { |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
614 // Extensions hosted in ExternalTabContainer objects may not have | 618 // Extensions hosted in ExternalTabContainer objects may not have |
615 // an associated browser. | 619 // an associated browser. |
616 Browser* browser = GetBrowser(); | 620 Browser* browser = GetBrowser(); |
617 if (browser) | 621 if (browser) |
618 window_id = ExtensionTabUtil::GetWindowId(browser); | 622 window_id = ExtensionTabUtil::GetWindowId(browser); |
619 } else if (extension_host_type_ != ViewType::EXTENSION_BACKGROUND_PAGE) { | 623 } else if (extension_host_type_ != ViewType::EXTENSION_BACKGROUND_PAGE) { |
620 NOTREACHED(); | 624 NOTREACHED(); |
621 } | 625 } |
622 return window_id; | 626 return window_id; |
623 } | 627 } |
OLD | NEW |