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/keyboard_codes.h" |
10 #include "app/l10n_util.h" | 10 #include "app/l10n_util.h" |
11 #include "app/resource_bundle.h" | 11 #include "app/resource_bundle.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" |
22 #include "chrome/browser/extensions/extension_message_service.h" | 22 #include "chrome/browser/extensions/extension_message_service.h" |
23 #include "chrome/browser/extensions/extension_tabs_module.h" | 23 #include "chrome/browser/extensions/extension_tabs_module.h" |
24 #include "chrome/browser/extensions/extensions_service.h" | 24 #include "chrome/browser/extensions/extensions_service.h" |
| 25 #include "chrome/browser/file_select_helper.h" |
25 #include "chrome/browser/in_process_webkit/dom_storage_context.h" | 26 #include "chrome/browser/in_process_webkit/dom_storage_context.h" |
26 #include "chrome/browser/in_process_webkit/webkit_context.h" | 27 #include "chrome/browser/in_process_webkit/webkit_context.h" |
27 #include "chrome/browser/message_box_handler.h" | 28 #include "chrome/browser/message_box_handler.h" |
28 #include "chrome/browser/platform_util.h" | 29 #include "chrome/browser/platform_util.h" |
29 #include "chrome/browser/prefs/pref_service.h" | 30 #include "chrome/browser/prefs/pref_service.h" |
30 #include "chrome/browser/profile.h" | 31 #include "chrome/browser/profile.h" |
31 #include "chrome/browser/renderer_host/render_process_host.h" | 32 #include "chrome/browser/renderer_host/render_process_host.h" |
32 #include "chrome/browser/renderer_host/render_view_host.h" | 33 #include "chrome/browser/renderer_host/render_view_host.h" |
33 #include "chrome/browser/renderer_host/render_widget_host.h" | 34 #include "chrome/browser/renderer_host/render_widget_host.h" |
34 #include "chrome/browser/renderer_host/render_widget_host_view.h" | 35 #include "chrome/browser/renderer_host/render_widget_host_view.h" |
(...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
670 extension_function_dispatcher_.reset( | 671 extension_function_dispatcher_.reset( |
671 ExtensionFunctionDispatcher::Create(render_view_host, this, url_)); | 672 ExtensionFunctionDispatcher::Create(render_view_host, this, url_)); |
672 | 673 |
673 if (extension_host_type_ == ViewType::EXTENSION_POPUP || | 674 if (extension_host_type_ == ViewType::EXTENSION_POPUP || |
674 extension_host_type_ == ViewType::EXTENSION_INFOBAR) { | 675 extension_host_type_ == ViewType::EXTENSION_INFOBAR) { |
675 render_view_host->EnablePreferredSizeChangedMode( | 676 render_view_host->EnablePreferredSizeChangedMode( |
676 kPreferredSizeWidth | kPreferredSizeHeightThisIsSlow); | 677 kPreferredSizeWidth | kPreferredSizeHeightThisIsSlow); |
677 } | 678 } |
678 } | 679 } |
679 | 680 |
| 681 RenderViewHostDelegate::FileSelect* ExtensionHost::GetFileSelectDelegate() { |
| 682 if (file_select_helper_.get() == NULL) |
| 683 file_select_helper_.reset(new FileSelectHelper(profile())); |
| 684 return file_select_helper_.get(); |
| 685 } |
| 686 |
680 int ExtensionHost::GetBrowserWindowID() const { | 687 int ExtensionHost::GetBrowserWindowID() const { |
681 // Hosts not attached to any browser window have an id of -1. This includes | 688 // Hosts not attached to any browser window have an id of -1. This includes |
682 // those mentioned below, and background pages. | 689 // those mentioned below, and background pages. |
683 int window_id = extension_misc::kUnknownWindowId; | 690 int window_id = extension_misc::kUnknownWindowId; |
684 if (extension_host_type_ == ViewType::EXTENSION_POPUP || | 691 if (extension_host_type_ == ViewType::EXTENSION_POPUP || |
685 extension_host_type_ == ViewType::EXTENSION_INFOBAR) { | 692 extension_host_type_ == ViewType::EXTENSION_INFOBAR) { |
686 // If the host is bound to a browser, then extract its window id. | 693 // If the host is bound to a browser, then extract its window id. |
687 // Extensions hosted in ExternalTabContainer objects may not have | 694 // Extensions hosted in ExternalTabContainer objects may not have |
688 // an associated browser. | 695 // an associated browser. |
689 Browser* browser = GetBrowser(); | 696 Browser* browser = GetBrowser(); |
690 if (browser) | 697 if (browser) |
691 window_id = ExtensionTabUtil::GetWindowId(browser); | 698 window_id = ExtensionTabUtil::GetWindowId(browser); |
692 } else if (extension_host_type_ != ViewType::EXTENSION_BACKGROUND_PAGE) { | 699 } else if (extension_host_type_ != ViewType::EXTENSION_BACKGROUND_PAGE) { |
693 NOTREACHED(); | 700 NOTREACHED(); |
694 } | 701 } |
695 return window_id; | 702 return window_id; |
696 } | 703 } |
OLD | NEW |