| 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" |
| 11 #include "base/keyboard_codes.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_theme_provider.h" | 18 #include "chrome/browser/browser_theme_provider.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/in_process_webkit/dom_storage_context.h" |
| 25 #include "chrome/browser/in_process_webkit/webkit_context.h" |
| 24 #include "chrome/browser/jsmessage_box_handler.h" | 26 #include "chrome/browser/jsmessage_box_handler.h" |
| 25 #include "chrome/browser/profile.h" | 27 #include "chrome/browser/profile.h" |
| 26 #include "chrome/browser/renderer_host/render_view_host.h" | 28 #include "chrome/browser/renderer_host/render_view_host.h" |
| 27 #include "chrome/browser/renderer_host/render_process_host.h" | 29 #include "chrome/browser/renderer_host/render_process_host.h" |
| 28 #include "chrome/browser/renderer_host/render_widget_host.h" | 30 #include "chrome/browser/renderer_host/render_widget_host.h" |
| 29 #include "chrome/browser/renderer_host/render_widget_host_view.h" | 31 #include "chrome/browser/renderer_host/render_widget_host_view.h" |
| 30 #include "chrome/browser/renderer_host/site_instance.h" | 32 #include "chrome/browser/renderer_host/site_instance.h" |
| 31 #include "chrome/browser/renderer_preferences_util.h" | 33 #include "chrome/browser/renderer_preferences_util.h" |
| 32 #include "chrome/browser/tab_contents/tab_contents.h" | 34 #include "chrome/browser/tab_contents/tab_contents.h" |
| 33 #include "chrome/browser/tab_contents/tab_contents_view.h" | 35 #include "chrome/browser/tab_contents/tab_contents_view.h" |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 // ExtensionHost | 118 // ExtensionHost |
| 117 | 119 |
| 118 ExtensionHost::ExtensionHost(Extension* extension, SiteInstance* site_instance, | 120 ExtensionHost::ExtensionHost(Extension* extension, SiteInstance* site_instance, |
| 119 const GURL& url, ViewType::Type host_type) | 121 const GURL& url, ViewType::Type host_type) |
| 120 : extension_(extension), | 122 : extension_(extension), |
| 121 profile_(site_instance->browsing_instance()->profile()), | 123 profile_(site_instance->browsing_instance()->profile()), |
| 122 did_stop_loading_(false), | 124 did_stop_loading_(false), |
| 123 document_element_available_(false), | 125 document_element_available_(false), |
| 124 url_(url), | 126 url_(url), |
| 125 extension_host_type_(host_type) { | 127 extension_host_type_(host_type) { |
| 126 render_view_host_ = new RenderViewHost(site_instance, this, MSG_ROUTING_NONE); | 128 // TODO(jorlow): Is creating a new "SessionStorage" per extension host the |
| 129 // right thing to do here? I'm really not sure. |
| 130 int64 session_storage_namespace_id = profile_->GetWebKitContext()-> |
| 131 dom_storage_context()->AllocateSessionStorageNamespaceId(); |
| 132 render_view_host_ = new RenderViewHost(site_instance, this, MSG_ROUTING_NONE, |
| 133 session_storage_namespace_id); |
| 127 render_view_host_->AllowBindings(BindingsPolicy::EXTENSION); | 134 render_view_host_->AllowBindings(BindingsPolicy::EXTENSION); |
| 128 if (enable_dom_automation_) | 135 if (enable_dom_automation_) |
| 129 render_view_host_->AllowBindings(BindingsPolicy::DOM_AUTOMATION); | 136 render_view_host_->AllowBindings(BindingsPolicy::DOM_AUTOMATION); |
| 130 | 137 |
| 131 // Listen for when the render process' handle is available so we can add it | 138 // Listen for when the render process' handle is available so we can add it |
| 132 // to the task manager then. | 139 // to the task manager then. |
| 133 registrar_.Add(this, NotificationType::RENDERER_PROCESS_CREATED, | 140 registrar_.Add(this, NotificationType::RENDERER_PROCESS_CREATED, |
| 134 Source<RenderProcessHost>(render_process_host())); | 141 Source<RenderProcessHost>(render_process_host())); |
| 135 } | 142 } |
| 136 | 143 |
| (...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 632 // Extensions hosted in ExternalTabContainer objects may not have | 639 // Extensions hosted in ExternalTabContainer objects may not have |
| 633 // an associated browser. | 640 // an associated browser. |
| 634 Browser* browser = GetBrowser(); | 641 Browser* browser = GetBrowser(); |
| 635 if (browser) | 642 if (browser) |
| 636 window_id = ExtensionTabUtil::GetWindowId(browser); | 643 window_id = ExtensionTabUtil::GetWindowId(browser); |
| 637 } else if (extension_host_type_ != ViewType::EXTENSION_BACKGROUND_PAGE) { | 644 } else if (extension_host_type_ != ViewType::EXTENSION_BACKGROUND_PAGE) { |
| 638 NOTREACHED(); | 645 NOTREACHED(); |
| 639 } | 646 } |
| 640 return window_id; | 647 return window_id; |
| 641 } | 648 } |
| OLD | NEW |