| 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/extensions/extension_system.h" |
| 9 #include "chrome/browser/net/predictor.h" | 10 #include "chrome/browser/net/predictor.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
| 11 #include "chrome/common/chrome_notification_types.h" | 12 #include "chrome/common/chrome_notification_types.h" |
| 12 #include "chrome/common/chrome_switches.h" | 13 #include "chrome/common/chrome_switches.h" |
| 13 #include "chrome/common/extensions/extension_messages.h" | 14 #include "chrome/common/extensions/extension_messages.h" |
| 14 #include "chrome/common/render_messages.h" | 15 #include "chrome/common/render_messages.h" |
| 15 #include "chrome/common/url_constants.h" | 16 #include "chrome/common/url_constants.h" |
| 16 #include "content/public/browser/child_process_security_policy.h" | 17 #include "content/public/browser/child_process_security_policy.h" |
| 17 #include "content/public/browser/notification_service.h" | 18 #include "content/public/browser/notification_service.h" |
| 18 #include "content/public/browser/render_process_host.h" | 19 #include "content/public/browser/render_process_host.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 IPC_END_MESSAGE_MAP() | 72 IPC_END_MESSAGE_MAP() |
| 72 return handled; | 73 return handled; |
| 73 } | 74 } |
| 74 | 75 |
| 75 void ChromeRenderViewHostObserver::InitRenderViewHostForExtensions() { | 76 void ChromeRenderViewHostObserver::InitRenderViewHostForExtensions() { |
| 76 const Extension* extension = GetExtension(); | 77 const Extension* extension = GetExtension(); |
| 77 if (!extension) | 78 if (!extension) |
| 78 return; | 79 return; |
| 79 | 80 |
| 80 ExtensionProcessManager* process_manager = | 81 ExtensionProcessManager* process_manager = |
| 81 profile_->GetExtensionProcessManager(); | 82 extensions::ExtensionSystem::Get(profile_)->process_manager(); |
| 82 CHECK(process_manager); | 83 CHECK(process_manager); |
| 83 | 84 |
| 84 // TODO(creis): Use this to replace SetInstalledAppForRenderer. | 85 // TODO(creis): Use this to replace SetInstalledAppForRenderer. |
| 85 process_manager->RegisterRenderViewHost(render_view_host(), extension); | 86 process_manager->RegisterRenderViewHost(render_view_host(), extension); |
| 86 } | 87 } |
| 87 | 88 |
| 88 void ChromeRenderViewHostObserver::InitRenderViewForExtensions() { | 89 void ChromeRenderViewHostObserver::InitRenderViewForExtensions() { |
| 89 const Extension* extension = GetExtension(); | 90 const Extension* extension = GetExtension(); |
| 90 if (!extension) | 91 if (!extension) |
| 91 return; | 92 return; |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 service->ReloadExtension(site.host()); | 151 service->ReloadExtension(site.host()); |
| 151 | 152 |
| 152 // May be null if the extension doesn't exist, for example if somebody typos | 153 // May be null if the extension doesn't exist, for example if somebody typos |
| 153 // a chrome-extension:// URL. | 154 // a chrome-extension:// URL. |
| 154 return service->extensions()->GetByID(site.host()); | 155 return service->extensions()->GetByID(site.host()); |
| 155 } | 156 } |
| 156 | 157 |
| 157 void ChromeRenderViewHostObserver::RemoveRenderViewHostForExtensions( | 158 void ChromeRenderViewHostObserver::RemoveRenderViewHostForExtensions( |
| 158 RenderViewHost* rvh) { | 159 RenderViewHost* rvh) { |
| 159 ExtensionProcessManager* process_manager = | 160 ExtensionProcessManager* process_manager = |
| 160 profile_->GetExtensionProcessManager(); | 161 extensions::ExtensionSystem::Get(profile_)->process_manager(); |
| 161 if (process_manager) | 162 if (process_manager) |
| 162 process_manager->UnregisterRenderViewHost(rvh); | 163 process_manager->UnregisterRenderViewHost(rvh); |
| 163 } | 164 } |
| 164 | 165 |
| 165 void ChromeRenderViewHostObserver::OnFocusedEditableNodeTouched() { | 166 void ChromeRenderViewHostObserver::OnFocusedEditableNodeTouched() { |
| 166 content::NotificationService::current()->Notify( | 167 content::NotificationService::current()->Notify( |
| 167 chrome::NOTIFICATION_FOCUSED_EDITABLE_NODE_TOUCHED, | 168 chrome::NOTIFICATION_FOCUSED_EDITABLE_NODE_TOUCHED, |
| 168 content::Source<RenderViewHost>(render_view_host()), | 169 content::Source<RenderViewHost>(render_view_host()), |
| 169 content::NotificationService::NoDetails()); | 170 content::NotificationService::NoDetails()); |
| 170 } | 171 } |
| OLD | NEW |