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/browser_window.h" | 18 #include "chrome/browser/browser_window.h" |
19 #include "chrome/browser/browsing_instance.h" | 19 #include "chrome/browser/browsing_instance.h" |
20 #include "chrome/browser/debugger/devtools_manager.h" | 20 #include "chrome/browser/debugger/devtools_manager.h" |
21 #include "chrome/browser/dom_ui/dom_ui_factory.h" | 21 #include "chrome/browser/dom_ui/dom_ui_factory.h" |
(...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
620 void ExtensionHost::Activate() { | 620 void ExtensionHost::Activate() { |
621 } | 621 } |
622 | 622 |
623 void ExtensionHost::Deactivate() { | 623 void ExtensionHost::Deactivate() { |
624 } | 624 } |
625 | 625 |
626 bool ExtensionHost::PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event, | 626 bool ExtensionHost::PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event, |
627 bool* is_keyboard_shortcut) { | 627 bool* is_keyboard_shortcut) { |
628 if (extension_host_type_ == ViewType::EXTENSION_POPUP && | 628 if (extension_host_type_ == ViewType::EXTENSION_POPUP && |
629 event.type == NativeWebKeyboardEvent::RawKeyDown && | 629 event.type == NativeWebKeyboardEvent::RawKeyDown && |
630 event.windowsKeyCode == base::VKEY_ESCAPE) { | 630 event.windowsKeyCode == app::VKEY_ESCAPE) { |
631 DCHECK(is_keyboard_shortcut != NULL); | 631 DCHECK(is_keyboard_shortcut != NULL); |
632 *is_keyboard_shortcut = true; | 632 *is_keyboard_shortcut = true; |
633 } | 633 } |
634 return false; | 634 return false; |
635 } | 635 } |
636 | 636 |
637 void ExtensionHost::HandleKeyboardEvent(const NativeWebKeyboardEvent& event) { | 637 void ExtensionHost::HandleKeyboardEvent(const NativeWebKeyboardEvent& event) { |
638 if (extension_host_type_ == ViewType::EXTENSION_POPUP) { | 638 if (extension_host_type_ == ViewType::EXTENSION_POPUP) { |
639 if (event.type == NativeWebKeyboardEvent::RawKeyDown && | 639 if (event.type == NativeWebKeyboardEvent::RawKeyDown && |
640 event.windowsKeyCode == base::VKEY_ESCAPE) { | 640 event.windowsKeyCode == app::VKEY_ESCAPE) { |
641 NotificationService::current()->Notify( | 641 NotificationService::current()->Notify( |
642 NotificationType::EXTENSION_HOST_VIEW_SHOULD_CLOSE, | 642 NotificationType::EXTENSION_HOST_VIEW_SHOULD_CLOSE, |
643 Source<Profile>(profile_), | 643 Source<Profile>(profile_), |
644 Details<ExtensionHost>(this)); | 644 Details<ExtensionHost>(this)); |
645 return; | 645 return; |
646 } | 646 } |
647 } | 647 } |
648 UnhandledKeyboardEvent(event); | 648 UnhandledKeyboardEvent(event); |
649 } | 649 } |
650 | 650 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
699 // Extensions hosted in ExternalTabContainer objects may not have | 699 // Extensions hosted in ExternalTabContainer objects may not have |
700 // an associated browser. | 700 // an associated browser. |
701 Browser* browser = GetBrowser(); | 701 Browser* browser = GetBrowser(); |
702 if (browser) | 702 if (browser) |
703 window_id = ExtensionTabUtil::GetWindowId(browser); | 703 window_id = ExtensionTabUtil::GetWindowId(browser); |
704 } else if (extension_host_type_ != ViewType::EXTENSION_BACKGROUND_PAGE) { | 704 } else if (extension_host_type_ != ViewType::EXTENSION_BACKGROUND_PAGE) { |
705 NOTREACHED(); | 705 NOTREACHED(); |
706 } | 706 } |
707 return window_id; | 707 return window_id; |
708 } | 708 } |
OLD | NEW |