Chromium Code Reviews| 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/renderer_host/chrome_render_view_host_observer.h" | 5 #include "chrome/browser/renderer_host/chrome_render_view_host_observer.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "chrome/browser/dom_operation_notification_details.h" | 8 #include "chrome/browser/dom_operation_notification_details.h" |
| 9 #include "chrome/browser/extensions/extension_service.h" | 9 #include "chrome/browser/extensions/extension_service.h" |
| 10 #include "chrome/browser/net/predictor.h" | 10 #include "chrome/browser/net/predictor.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 87 } | 87 } |
| 88 | 88 |
| 89 // Enable extension bindings for the renderer. Currently only extensions, | 89 // Enable extension bindings for the renderer. Currently only extensions, |
| 90 // packaged apps, and hosted component apps use extension bindings. | 90 // packaged apps, and hosted component apps use extension bindings. |
| 91 Extension::Type type = extension->GetType(); | 91 Extension::Type type = extension->GetType(); |
| 92 if (type == Extension::TYPE_EXTENSION || | 92 if (type == Extension::TYPE_EXTENSION || |
| 93 type == Extension::TYPE_USER_SCRIPT || | 93 type == Extension::TYPE_USER_SCRIPT || |
| 94 type == Extension::TYPE_PACKAGED_APP || | 94 type == Extension::TYPE_PACKAGED_APP || |
| 95 (type == Extension::TYPE_HOSTED_APP && | 95 (type == Extension::TYPE_HOSTED_APP && |
| 96 extension->location() == Extension::COMPONENT)) { | 96 extension->location() == Extension::COMPONENT)) { |
| 97 render_view_host()->AllowBindings(BindingsPolicy::EXTENSION); | 97 render_view_host()->AllowBindings(BindingsPolicy::EXTENSION); |
|
Aaron Boodman
2011/09/27 19:26:49
I had hoped we'd be able to get rid of BindingsPol
jochen (gone - plz use gerrit)
2011/09/27 20:41:40
True, looks like we could get rid of this entirely
Aaron Boodman
2011/09/27 20:50:53
Actually, now that I look at this, how come we can
| |
| 98 ChildProcessSecurityPolicy::GetInstance()->GrantExtensionBindings( | 98 ChildProcessSecurityPolicy::GetInstance()->GrantExtensionBindings( |
| 99 render_view_host()->process()->id()); | 99 render_view_host()->process()->id()); |
| 100 process_manager->RegisterProcessHostWithBindings( | |
| 101 render_view_host()->process()->id()); | |
| 100 } | 102 } |
| 101 } | 103 } |
| 102 | 104 |
| 103 void ChromeRenderViewHostObserver::InitRenderViewForExtensions() { | 105 void ChromeRenderViewHostObserver::InitRenderViewForExtensions() { |
| 104 const Extension* extension = GetExtension(); | 106 const Extension* extension = GetExtension(); |
| 105 if (!extension) | 107 if (!extension) |
| 106 return; | 108 return; |
| 107 | 109 |
| 108 SiteInstance* site_instance = render_view_host()->site_instance(); | 110 SiteInstance* site_instance = render_view_host()->site_instance(); |
| 109 Profile* profile = Profile::FromBrowserContext( | 111 Profile* profile = Profile::FromBrowserContext( |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 158 } | 160 } |
| 159 | 161 |
| 160 void ChromeRenderViewHostObserver::OnDomOperationResponse( | 162 void ChromeRenderViewHostObserver::OnDomOperationResponse( |
| 161 const std::string& json_string, int automation_id) { | 163 const std::string& json_string, int automation_id) { |
| 162 DomOperationNotificationDetails details(json_string, automation_id); | 164 DomOperationNotificationDetails details(json_string, automation_id); |
| 163 NotificationService::current()->Notify( | 165 NotificationService::current()->Notify( |
| 164 chrome::NOTIFICATION_DOM_OPERATION_RESPONSE, | 166 chrome::NOTIFICATION_DOM_OPERATION_RESPONSE, |
| 165 Source<RenderViewHost>(render_view_host()), | 167 Source<RenderViewHost>(render_view_host()), |
| 166 Details<DomOperationNotificationDetails>(&details)); | 168 Details<DomOperationNotificationDetails>(&details)); |
| 167 } | 169 } |
| OLD | NEW |