| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| 11 #include "base/singleton.h" | 11 #include "base/singleton.h" |
| 12 #include "base/string_util.h" | 12 #include "base/string_util.h" |
| 13 #include "chrome/browser/browser_list.h" | 13 #include "chrome/browser/browser_list.h" |
| 14 #include "chrome/browser/browser_shutdown.h" | 14 #include "chrome/browser/browser_shutdown.h" |
| 15 #include "chrome/browser/browser_window.h" | 15 #include "chrome/browser/browser_window.h" |
| 16 #include "chrome/browser/debugger/devtools_manager.h" | 16 #include "chrome/browser/debugger/devtools_manager.h" |
| 17 #include "chrome/browser/desktop_notification_handler.h" | 17 #include "chrome/browser/desktop_notification_handler.h" |
| 18 #include "chrome/browser/extensions/extension_message_service.h" | 18 #include "chrome/browser/extensions/extension_message_service.h" |
| 19 #include "chrome/browser/extensions/extension_service.h" | 19 #include "chrome/browser/extensions/extension_service.h" |
| 20 #include "chrome/browser/extensions/extension_tabs_module.h" | 20 #include "chrome/browser/extensions/extension_tabs_module.h" |
| 21 #include "chrome/browser/file_select_helper.h" | 21 #include "chrome/browser/file_select_helper.h" |
| 22 #include "chrome/browser/platform_util.h" | 22 #include "chrome/browser/platform_util.h" |
| 23 #include "chrome/browser/profiles/profile.h" | 23 #include "chrome/browser/profiles/profile.h" |
| 24 #include "chrome/browser/renderer_host/browser_render_process_host.h" |
| 24 #include "chrome/browser/renderer_preferences_util.h" | 25 #include "chrome/browser/renderer_preferences_util.h" |
| 25 #include "chrome/browser/tab_contents/popup_menu_helper_mac.h" | 26 #include "chrome/browser/tab_contents/popup_menu_helper_mac.h" |
| 26 #include "chrome/browser/themes/browser_theme_provider.h" | 27 #include "chrome/browser/themes/browser_theme_provider.h" |
| 27 #include "chrome/browser/ui/app_modal_dialogs/message_box_handler.h" | 28 #include "chrome/browser/ui/app_modal_dialogs/message_box_handler.h" |
| 28 #include "chrome/browser/ui/browser.h" | 29 #include "chrome/browser/ui/browser.h" |
| 29 #include "chrome/common/chrome_constants.h" | 30 #include "chrome/common/chrome_constants.h" |
| 30 #include "chrome/common/bindings_policy.h" | 31 #include "chrome/common/bindings_policy.h" |
| 31 #include "chrome/common/extensions/extension.h" | 32 #include "chrome/common/extensions/extension.h" |
| 32 #include "chrome/common/extensions/extension_constants.h" | 33 #include "chrome/common/extensions/extension_constants.h" |
| 33 #include "chrome/common/native_web_keyboard_event.h" | 34 #include "chrome/common/native_web_keyboard_event.h" |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 profile_(site_instance->browsing_instance()->profile()), | 131 profile_(site_instance->browsing_instance()->profile()), |
| 131 did_stop_loading_(false), | 132 did_stop_loading_(false), |
| 132 document_element_available_(false), | 133 document_element_available_(false), |
| 133 url_(url), | 134 url_(url), |
| 134 extension_host_type_(host_type), | 135 extension_host_type_(host_type), |
| 135 associated_tab_contents_(NULL), | 136 associated_tab_contents_(NULL), |
| 136 suppress_javascript_messages_(false) { | 137 suppress_javascript_messages_(false) { |
| 137 render_view_host_ = new RenderViewHost(site_instance, this, MSG_ROUTING_NONE, | 138 render_view_host_ = new RenderViewHost(site_instance, this, MSG_ROUTING_NONE, |
| 138 NULL); | 139 NULL); |
| 139 render_view_host_->set_is_extension_process(true); | 140 render_view_host_->set_is_extension_process(true); |
| 141 if (extension->is_app()) { |
| 142 BrowserRenderProcessHost* process = static_cast<BrowserRenderProcessHost*>( |
| 143 render_view_host_->process()); |
| 144 process->set_installed_app(extension); |
| 145 } |
| 140 render_view_host_->AllowBindings(BindingsPolicy::EXTENSION); | 146 render_view_host_->AllowBindings(BindingsPolicy::EXTENSION); |
| 141 if (enable_dom_automation_) | 147 if (enable_dom_automation_) |
| 142 render_view_host_->AllowBindings(BindingsPolicy::DOM_AUTOMATION); | 148 render_view_host_->AllowBindings(BindingsPolicy::DOM_AUTOMATION); |
| 143 | 149 |
| 144 // Listen for when the render process' handle is available so we can add it | 150 // Listen for when the render process' handle is available so we can add it |
| 145 // to the task manager then. | 151 // to the task manager then. |
| 146 registrar_.Add(this, NotificationType::RENDERER_PROCESS_CREATED, | 152 registrar_.Add(this, NotificationType::RENDERER_PROCESS_CREATED, |
| 147 Source<RenderProcessHost>(render_process_host())); | 153 Source<RenderProcessHost>(render_process_host())); |
| 148 // Listen for when an extension is unloaded from the same profile, as it may | 154 // Listen for when an extension is unloaded from the same profile, as it may |
| 149 // be the same extension that this points to. | 155 // be the same extension that this points to. |
| (...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 835 } | 841 } |
| 836 return window_id; | 842 return window_id; |
| 837 } | 843 } |
| 838 | 844 |
| 839 void ExtensionHost::OnRunFileChooser( | 845 void ExtensionHost::OnRunFileChooser( |
| 840 const ViewHostMsg_RunFileChooser_Params& params) { | 846 const ViewHostMsg_RunFileChooser_Params& params) { |
| 841 if (file_select_helper_.get() == NULL) | 847 if (file_select_helper_.get() == NULL) |
| 842 file_select_helper_.reset(new FileSelectHelper(profile())); | 848 file_select_helper_.reset(new FileSelectHelper(profile())); |
| 843 file_select_helper_->RunFileChooser(render_view_host_, params); | 849 file_select_helper_->RunFileChooser(render_view_host_, params); |
| 844 } | 850 } |
| OLD | NEW |