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 "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "chrome/browser/browser.h" | 10 #include "chrome/browser/browser.h" |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 } | 70 } |
71 | 71 |
72 private: | 72 private: |
73 ExtensionHost* extension_host_; | 73 ExtensionHost* extension_host_; |
74 | 74 |
75 DISALLOW_COPY_AND_ASSIGN(CrashedExtensionInfobarDelegate); | 75 DISALLOW_COPY_AND_ASSIGN(CrashedExtensionInfobarDelegate); |
76 }; | 76 }; |
77 | 77 |
78 } // namespace | 78 } // namespace |
79 | 79 |
| 80 |
| 81 // static |
| 82 bool ExtensionHost::enable_dom_automation_ = false; |
| 83 |
80 ExtensionHost::ExtensionHost(Extension* extension, SiteInstance* site_instance, | 84 ExtensionHost::ExtensionHost(Extension* extension, SiteInstance* site_instance, |
81 const GURL& url) | 85 const GURL& url) |
82 : extension_(extension), | 86 : extension_(extension), |
83 profile_(site_instance->browsing_instance()->profile()), | 87 profile_(site_instance->browsing_instance()->profile()), |
84 did_stop_loading_(false), | 88 did_stop_loading_(false), |
85 url_(url) { | 89 url_(url) { |
86 render_view_host_ = new RenderViewHost( | 90 render_view_host_ = new RenderViewHost( |
87 site_instance, this, MSG_ROUTING_NONE, NULL); | 91 site_instance, this, MSG_ROUTING_NONE, NULL); |
88 render_view_host_->AllowBindings(BindingsPolicy::EXTENSION); | 92 render_view_host_->AllowBindings(BindingsPolicy::EXTENSION); |
| 93 if (enable_dom_automation_) |
| 94 render_view_host_->AllowBindings(BindingsPolicy::DOM_AUTOMATION); |
89 } | 95 } |
90 | 96 |
91 ExtensionHost::~ExtensionHost() { | 97 ExtensionHost::~ExtensionHost() { |
92 NotificationService::current()->Notify( | 98 NotificationService::current()->Notify( |
93 NotificationType::EXTENSION_HOST_DESTROYED, | 99 NotificationType::EXTENSION_HOST_DESTROYED, |
94 Source<Profile>(profile_), | 100 Source<Profile>(profile_), |
95 Details<ExtensionHost>(this)); | 101 Details<ExtensionHost>(this)); |
96 render_view_host_->Shutdown(); // deletes render_view_host | 102 render_view_host_->Shutdown(); // deletes render_view_host |
97 } | 103 } |
98 | 104 |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 int request_id, | 309 int request_id, |
304 bool has_callback) { | 310 bool has_callback) { |
305 extension_function_dispatcher_->HandleRequest(message, content, request_id, | 311 extension_function_dispatcher_->HandleRequest(message, content, request_id, |
306 has_callback); | 312 has_callback); |
307 } | 313 } |
308 | 314 |
309 void ExtensionHost::RenderViewCreated(RenderViewHost* render_view_host) { | 315 void ExtensionHost::RenderViewCreated(RenderViewHost* render_view_host) { |
310 extension_function_dispatcher_.reset( | 316 extension_function_dispatcher_.reset( |
311 new ExtensionFunctionDispatcher(render_view_host_, this, url_)); | 317 new ExtensionFunctionDispatcher(render_view_host_, this, url_)); |
312 } | 318 } |
OLD | NEW |