| 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 CHECK(process_manager); | 80 CHECK(process_manager); |
| 81 | 81 |
| 82 // TODO(creis): Use this to replace SetInstalledAppForRenderer. | 82 // TODO(creis): Use this to replace SetInstalledAppForRenderer. |
| 83 process_manager->RegisterRenderViewHost(render_view_host(), extension); | 83 process_manager->RegisterRenderViewHost(render_view_host(), extension); |
| 84 | 84 |
| 85 if (extension->is_app()) { | 85 if (extension->is_app()) { |
| 86 // Record which, if any, installed app is associated with this process. | 86 // Record which, if any, installed app is associated with this process. |
| 87 // TODO(aa): Totally lame to store this state in a global map in extension | 87 // TODO(aa): Totally lame to store this state in a global map in extension |
| 88 // service. Can we get it from EPM instead? | 88 // service. Can we get it from EPM instead? |
| 89 profile_->GetExtensionService()->SetInstalledAppForRenderer( | 89 profile_->GetExtensionService()->SetInstalledAppForRenderer( |
| 90 render_view_host()->process()->id(), extension); | 90 render_view_host()->process()->GetID(), extension); |
| 91 } | 91 } |
| 92 } | 92 } |
| 93 | 93 |
| 94 void ChromeRenderViewHostObserver::InitRenderViewForExtensions() { | 94 void ChromeRenderViewHostObserver::InitRenderViewForExtensions() { |
| 95 const Extension* extension = GetExtension(); | 95 const Extension* extension = GetExtension(); |
| 96 if (!extension) | 96 if (!extension) |
| 97 return; | 97 return; |
| 98 | 98 |
| 99 RenderProcessHost* process = render_view_host()->process(); | 99 RenderProcessHost* process = render_view_host()->process(); |
| 100 | 100 |
| 101 if (extension->is_app()) { | 101 if (extension->is_app()) { |
| 102 Send(new ExtensionMsg_ActivateApplication(extension->id())); | 102 Send(new ExtensionMsg_ActivateApplication(extension->id())); |
| 103 // Though we already record the associated process ID for the renderer in | 103 // Though we already record the associated process ID for the renderer in |
| 104 // InitRenderViewHostForExtensions, the process might have crashed and been | 104 // InitRenderViewHostForExtensions, the process might have crashed and been |
| 105 // restarted (hence the re-initialization), so we need to update that | 105 // restarted (hence the re-initialization), so we need to update that |
| 106 // mapping. | 106 // mapping. |
| 107 profile_->GetExtensionService()->SetInstalledAppForRenderer( | 107 profile_->GetExtensionService()->SetInstalledAppForRenderer( |
| 108 process->id(), extension); | 108 process->GetID(), extension); |
| 109 } | 109 } |
| 110 | 110 |
| 111 // Some extensions use chrome:// URLs. | 111 // Some extensions use chrome:// URLs. |
| 112 Extension::Type type = extension->GetType(); | 112 Extension::Type type = extension->GetType(); |
| 113 if (type == Extension::TYPE_EXTENSION || | 113 if (type == Extension::TYPE_EXTENSION || |
| 114 type == Extension::TYPE_PACKAGED_APP) { | 114 type == Extension::TYPE_PACKAGED_APP) { |
| 115 ChildProcessSecurityPolicy::GetInstance()->GrantScheme( | 115 ChildProcessSecurityPolicy::GetInstance()->GrantScheme( |
| 116 process->id(), chrome::kChromeUIScheme); | 116 process->GetID(), chrome::kChromeUIScheme); |
| 117 } | 117 } |
| 118 | 118 |
| 119 if (type == Extension::TYPE_EXTENSION || | 119 if (type == Extension::TYPE_EXTENSION || |
| 120 type == Extension::TYPE_USER_SCRIPT || | 120 type == Extension::TYPE_USER_SCRIPT || |
| 121 type == Extension::TYPE_PACKAGED_APP || | 121 type == Extension::TYPE_PACKAGED_APP || |
| 122 (type == Extension::TYPE_HOSTED_APP && | 122 (type == Extension::TYPE_HOSTED_APP && |
| 123 extension->location() == Extension::COMPONENT)) { | 123 extension->location() == Extension::COMPONENT)) { |
| 124 Send(new ExtensionMsg_ActivateExtension(extension->id())); | 124 Send(new ExtensionMsg_ActivateExtension(extension->id())); |
| 125 } | 125 } |
| 126 } | 126 } |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 content::Source<RenderViewHost>(render_view_host()), | 167 content::Source<RenderViewHost>(render_view_host()), |
| 168 content::Details<DomOperationNotificationDetails>(&details)); | 168 content::Details<DomOperationNotificationDetails>(&details)); |
| 169 } | 169 } |
| 170 | 170 |
| 171 void ChromeRenderViewHostObserver::OnFocusedEditableNodeTouched() { | 171 void ChromeRenderViewHostObserver::OnFocusedEditableNodeTouched() { |
| 172 content::NotificationService::current()->Notify( | 172 content::NotificationService::current()->Notify( |
| 173 chrome::NOTIFICATION_FOCUSED_EDITABLE_NODE_TOUCHED, | 173 chrome::NOTIFICATION_FOCUSED_EDITABLE_NODE_TOUCHED, |
| 174 content::Source<RenderViewHost>(render_view_host()), | 174 content::Source<RenderViewHost>(render_view_host()), |
| 175 content::NotificationService::NoDetails()); | 175 content::NotificationService::NoDetails()); |
| 176 } | 176 } |
| OLD | NEW |