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/file_select_helper.h" |
26 #include "chrome/browser/in_process_webkit/dom_storage_context.h" | |
27 #include "chrome/browser/in_process_webkit/webkit_context.h" | |
28 #include "chrome/browser/message_box_handler.h" | 26 #include "chrome/browser/message_box_handler.h" |
29 #include "chrome/browser/platform_util.h" | 27 #include "chrome/browser/platform_util.h" |
30 #include "chrome/browser/prefs/pref_service.h" | 28 #include "chrome/browser/prefs/pref_service.h" |
31 #include "chrome/browser/profile.h" | 29 #include "chrome/browser/profile.h" |
32 #include "chrome/browser/renderer_host/render_process_host.h" | 30 #include "chrome/browser/renderer_host/render_process_host.h" |
33 #include "chrome/browser/renderer_host/render_view_host.h" | 31 #include "chrome/browser/renderer_host/render_view_host.h" |
34 #include "chrome/browser/renderer_host/render_widget_host.h" | 32 #include "chrome/browser/renderer_host/render_widget_host.h" |
35 #include "chrome/browser/renderer_host/render_widget_host_view.h" | 33 #include "chrome/browser/renderer_host/render_widget_host_view.h" |
36 #include "chrome/browser/renderer_host/site_instance.h" | 34 #include "chrome/browser/renderer_host/site_instance.h" |
37 #include "chrome/browser/renderer_preferences_util.h" | 35 #include "chrome/browser/renderer_preferences_util.h" |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 | 122 |
125 ExtensionHost::ExtensionHost(Extension* extension, SiteInstance* site_instance, | 123 ExtensionHost::ExtensionHost(Extension* extension, SiteInstance* site_instance, |
126 const GURL& url, ViewType::Type host_type) | 124 const GURL& url, ViewType::Type host_type) |
127 : extension_(extension), | 125 : extension_(extension), |
128 profile_(site_instance->browsing_instance()->profile()), | 126 profile_(site_instance->browsing_instance()->profile()), |
129 did_stop_loading_(false), | 127 did_stop_loading_(false), |
130 document_element_available_(false), | 128 document_element_available_(false), |
131 url_(url), | 129 url_(url), |
132 extension_host_type_(host_type), | 130 extension_host_type_(host_type), |
133 associated_tab_contents_(NULL) { | 131 associated_tab_contents_(NULL) { |
134 int64 session_storage_namespace_id = profile_->GetWebKitContext()-> | |
135 dom_storage_context()->AllocateSessionStorageNamespaceId(); | |
136 render_view_host_ = new RenderViewHost(site_instance, this, MSG_ROUTING_NONE, | 132 render_view_host_ = new RenderViewHost(site_instance, this, MSG_ROUTING_NONE, |
137 session_storage_namespace_id); | 133 NULL); |
138 render_view_host_->set_is_extension_process(true); | 134 render_view_host_->set_is_extension_process(true); |
139 render_view_host_->AllowBindings(BindingsPolicy::EXTENSION); | 135 render_view_host_->AllowBindings(BindingsPolicy::EXTENSION); |
140 if (enable_dom_automation_) | 136 if (enable_dom_automation_) |
141 render_view_host_->AllowBindings(BindingsPolicy::DOM_AUTOMATION); | 137 render_view_host_->AllowBindings(BindingsPolicy::DOM_AUTOMATION); |
142 | 138 |
143 // Listen for when the render process' handle is available so we can add it | 139 // Listen for when the render process' handle is available so we can add it |
144 // to the task manager then. | 140 // to the task manager then. |
145 registrar_.Add(this, NotificationType::RENDERER_PROCESS_CREATED, | 141 registrar_.Add(this, NotificationType::RENDERER_PROCESS_CREATED, |
146 Source<RenderProcessHost>(render_process_host())); | 142 Source<RenderProcessHost>(render_process_host())); |
147 // Listen for when an extension is unloaded from the same profile, as it may | 143 // Listen for when an extension is unloaded from the same profile, as it may |
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
721 // Extensions hosted in ExternalTabContainer objects may not have | 717 // Extensions hosted in ExternalTabContainer objects may not have |
722 // an associated browser. | 718 // an associated browser. |
723 Browser* browser = GetBrowser(); | 719 Browser* browser = GetBrowser(); |
724 if (browser) | 720 if (browser) |
725 window_id = ExtensionTabUtil::GetWindowId(browser); | 721 window_id = ExtensionTabUtil::GetWindowId(browser); |
726 } else if (extension_host_type_ != ViewType::EXTENSION_BACKGROUND_PAGE) { | 722 } else if (extension_host_type_ != ViewType::EXTENSION_BACKGROUND_PAGE) { |
727 NOTREACHED(); | 723 NOTREACHED(); |
728 } | 724 } |
729 return window_id; | 725 return window_id; |
730 } | 726 } |
OLD | NEW |