| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/extensions/extension_service.h" | 8 #include "chrome/browser/extensions/extension_service.h" |
| 9 #include "chrome/browser/net/predictor.h" | 9 #include "chrome/browser/net/predictor.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 // InitRenderViewHostForExtensions, the process might have crashed and been | 97 // InitRenderViewHostForExtensions, the process might have crashed and been |
| 98 // restarted (hence the re-initialization), so we need to update that | 98 // restarted (hence the re-initialization), so we need to update that |
| 99 // mapping. | 99 // mapping. |
| 100 profile_->GetExtensionService()->SetInstalledAppForRenderer( | 100 profile_->GetExtensionService()->SetInstalledAppForRenderer( |
| 101 process->GetID(), extension); | 101 process->GetID(), extension); |
| 102 } | 102 } |
| 103 | 103 |
| 104 // Some extensions use chrome:// URLs. | 104 // Some extensions use chrome:// URLs. |
| 105 Extension::Type type = extension->GetType(); | 105 Extension::Type type = extension->GetType(); |
| 106 if (type == Extension::TYPE_EXTENSION || | 106 if (type == Extension::TYPE_EXTENSION || |
| 107 type == Extension::TYPE_PACKAGED_APP) { | 107 type == Extension::TYPE_LEGACY_PACKAGED_APP) { |
| 108 ChildProcessSecurityPolicy::GetInstance()->GrantScheme( | 108 ChildProcessSecurityPolicy::GetInstance()->GrantScheme( |
| 109 process->GetID(), chrome::kChromeUIScheme); | 109 process->GetID(), chrome::kChromeUIScheme); |
| 110 | 110 |
| 111 if (profile_->GetExtensionService()->extension_prefs()->AllowFileAccess( | 111 if (profile_->GetExtensionService()->extension_prefs()->AllowFileAccess( |
| 112 extension->id())) { | 112 extension->id())) { |
| 113 ChildProcessSecurityPolicy::GetInstance()->GrantScheme( | 113 ChildProcessSecurityPolicy::GetInstance()->GrantScheme( |
| 114 process->GetID(), chrome::kFileScheme); | 114 process->GetID(), chrome::kFileScheme); |
| 115 } | 115 } |
| 116 } | 116 } |
| 117 | 117 |
| 118 switch (type) { | 118 switch (type) { |
| 119 case Extension::TYPE_EXTENSION: | 119 case Extension::TYPE_EXTENSION: |
| 120 case Extension::TYPE_USER_SCRIPT: | 120 case Extension::TYPE_USER_SCRIPT: |
| 121 case Extension::TYPE_HOSTED_APP: | 121 case Extension::TYPE_HOSTED_APP: |
| 122 case Extension::TYPE_PACKAGED_APP: | 122 case Extension::TYPE_LEGACY_PACKAGED_APP: |
| 123 case Extension::TYPE_PLATFORM_APP: | 123 case Extension::TYPE_PLATFORM_APP: |
| 124 // Always send a Loaded message before ActivateExtension so that | 124 // Always send a Loaded message before ActivateExtension so that |
| 125 // ExtensionDispatcher knows what Extension is active, not just its ID. | 125 // ExtensionDispatcher knows what Extension is active, not just its ID. |
| 126 // This is important for classifying the Extension's JavaScript context | 126 // This is important for classifying the Extension's JavaScript context |
| 127 // correctly (see ExtensionDispatcher::ClassifyJavaScriptContext). | 127 // correctly (see ExtensionDispatcher::ClassifyJavaScriptContext). |
| 128 Send(new ExtensionMsg_Loaded( | 128 Send(new ExtensionMsg_Loaded( |
| 129 std::vector<ExtensionMsg_Loaded_Params>( | 129 std::vector<ExtensionMsg_Loaded_Params>( |
| 130 1, ExtensionMsg_Loaded_Params(extension)))); | 130 1, ExtensionMsg_Loaded_Params(extension)))); |
| 131 Send(new ExtensionMsg_ActivateExtension(extension->id())); | 131 Send(new ExtensionMsg_ActivateExtension(extension->id())); |
| 132 break; | 132 break; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 if (process_manager) | 170 if (process_manager) |
| 171 process_manager->UnregisterRenderViewHost(rvh); | 171 process_manager->UnregisterRenderViewHost(rvh); |
| 172 } | 172 } |
| 173 | 173 |
| 174 void ChromeRenderViewHostObserver::OnFocusedEditableNodeTouched() { | 174 void ChromeRenderViewHostObserver::OnFocusedEditableNodeTouched() { |
| 175 content::NotificationService::current()->Notify( | 175 content::NotificationService::current()->Notify( |
| 176 chrome::NOTIFICATION_FOCUSED_EDITABLE_NODE_TOUCHED, | 176 chrome::NOTIFICATION_FOCUSED_EDITABLE_NODE_TOUCHED, |
| 177 content::Source<RenderViewHost>(render_view_host()), | 177 content::Source<RenderViewHost>(render_view_host()), |
| 178 content::NotificationService::NoDetails()); | 178 content::NotificationService::NoDetails()); |
| 179 } | 179 } |
| OLD | NEW |