OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/keyboard_codes.h" |
9 #include "app/l10n_util.h" | 10 #include "app/l10n_util.h" |
10 #include "app/resource_bundle.h" | 11 #include "app/resource_bundle.h" |
11 #include "base/keyboard_codes.h" | |
12 #include "base/message_loop.h" | 12 #include "base/message_loop.h" |
13 #include "base/singleton.h" | 13 #include "base/singleton.h" |
14 #include "base/string_util.h" | 14 #include "base/string_util.h" |
15 #include "chrome/browser/browser.h" | 15 #include "chrome/browser/browser.h" |
16 #include "chrome/browser/browser_list.h" | 16 #include "chrome/browser/browser_list.h" |
17 #include "chrome/browser/browser_shutdown.h" | 17 #include "chrome/browser/browser_shutdown.h" |
18 #include "chrome/browser/browsing_instance.h" | 18 #include "chrome/browser/browsing_instance.h" |
19 #include "chrome/browser/debugger/devtools_manager.h" | 19 #include "chrome/browser/debugger/devtools_manager.h" |
20 #include "chrome/browser/dom_ui/dom_ui_factory.h" | 20 #include "chrome/browser/dom_ui/dom_ui_factory.h" |
21 #include "chrome/browser/extensions/extension_message_service.h" | 21 #include "chrome/browser/extensions/extension_message_service.h" |
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
612 void ExtensionHost::Activate() { | 612 void ExtensionHost::Activate() { |
613 } | 613 } |
614 | 614 |
615 void ExtensionHost::Deactivate() { | 615 void ExtensionHost::Deactivate() { |
616 } | 616 } |
617 | 617 |
618 bool ExtensionHost::PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event, | 618 bool ExtensionHost::PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event, |
619 bool* is_keyboard_shortcut) { | 619 bool* is_keyboard_shortcut) { |
620 if (extension_host_type_ == ViewType::EXTENSION_POPUP && | 620 if (extension_host_type_ == ViewType::EXTENSION_POPUP && |
621 event.type == NativeWebKeyboardEvent::RawKeyDown && | 621 event.type == NativeWebKeyboardEvent::RawKeyDown && |
622 event.windowsKeyCode == base::VKEY_ESCAPE) { | 622 event.windowsKeyCode == app::VKEY_ESCAPE) { |
623 DCHECK(is_keyboard_shortcut != NULL); | 623 DCHECK(is_keyboard_shortcut != NULL); |
624 *is_keyboard_shortcut = true; | 624 *is_keyboard_shortcut = true; |
625 } | 625 } |
626 return false; | 626 return false; |
627 } | 627 } |
628 | 628 |
629 void ExtensionHost::HandleKeyboardEvent(const NativeWebKeyboardEvent& event) { | 629 void ExtensionHost::HandleKeyboardEvent(const NativeWebKeyboardEvent& event) { |
630 if (extension_host_type_ == ViewType::EXTENSION_POPUP) { | 630 if (extension_host_type_ == ViewType::EXTENSION_POPUP) { |
631 if (event.type == NativeWebKeyboardEvent::RawKeyDown && | 631 if (event.type == NativeWebKeyboardEvent::RawKeyDown && |
632 event.windowsKeyCode == base::VKEY_ESCAPE) { | 632 event.windowsKeyCode == app::VKEY_ESCAPE) { |
633 NotificationService::current()->Notify( | 633 NotificationService::current()->Notify( |
634 NotificationType::EXTENSION_HOST_VIEW_SHOULD_CLOSE, | 634 NotificationType::EXTENSION_HOST_VIEW_SHOULD_CLOSE, |
635 Source<Profile>(profile_), | 635 Source<Profile>(profile_), |
636 Details<ExtensionHost>(this)); | 636 Details<ExtensionHost>(this)); |
637 return; | 637 return; |
638 } | 638 } |
639 } | 639 } |
640 UnhandledKeyboardEvent(event); | 640 UnhandledKeyboardEvent(event); |
641 } | 641 } |
642 | 642 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
691 // Extensions hosted in ExternalTabContainer objects may not have | 691 // Extensions hosted in ExternalTabContainer objects may not have |
692 // an associated browser. | 692 // an associated browser. |
693 Browser* browser = GetBrowser(); | 693 Browser* browser = GetBrowser(); |
694 if (browser) | 694 if (browser) |
695 window_id = ExtensionTabUtil::GetWindowId(browser); | 695 window_id = ExtensionTabUtil::GetWindowId(browser); |
696 } else if (extension_host_type_ != ViewType::EXTENSION_BACKGROUND_PAGE) { | 696 } else if (extension_host_type_ != ViewType::EXTENSION_BACKGROUND_PAGE) { |
697 NOTREACHED(); | 697 NOTREACHED(); |
698 } | 698 } |
699 return window_id; | 699 return window_id; |
700 } | 700 } |
OLD | NEW |