Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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_function_dispatcher.h" | 5 #include "chrome/browser/extensions/extension_function_dispatcher.h" |
| 6 | 6 |
| 7 #include "base/process_util.h" | 7 #include "base/process_util.h" |
| 8 #include "base/singleton.h" | 8 #include "base/singleton.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "chrome/browser/extensions/extension_bookmarks_module.h" | 10 #include "chrome/browser/extensions/extension_bookmarks_module.h" |
| 11 #include "chrome/browser/extensions/extension_bookmarks_module_constants.h" | 11 #include "chrome/browser/extensions/extension_bookmarks_module_constants.h" |
| 12 #include "chrome/browser/extensions/extension_function.h" | 12 #include "chrome/browser/extensions/extension_function.h" |
| 13 #include "chrome/browser/extensions/extension_message_service.h" | 13 #include "chrome/browser/extensions/extension_message_service.h" |
| 14 #include "chrome/browser/extensions/extension_page_actions_module.h" | 14 #include "chrome/browser/extensions/extension_page_actions_module.h" |
| 15 #include "chrome/browser/extensions/extension_page_actions_module_constants.h" | 15 #include "chrome/browser/extensions/extension_page_actions_module_constants.h" |
| 16 #include "chrome/browser/extensions/extension_process_manager.h" | |
| 16 #include "chrome/browser/extensions/extension_tabs_module.h" | 17 #include "chrome/browser/extensions/extension_tabs_module.h" |
| 17 #include "chrome/browser/extensions/extension_tabs_module_constants.h" | 18 #include "chrome/browser/extensions/extension_tabs_module_constants.h" |
| 18 #include "chrome/browser/profile.h" | 19 #include "chrome/browser/profile.h" |
| 19 #include "chrome/browser/renderer_host/render_process_host.h" | 20 #include "chrome/browser/renderer_host/render_process_host.h" |
| 20 #include "chrome/browser/renderer_host/render_view_host.h" | 21 #include "chrome/browser/renderer_host/render_view_host.h" |
| 21 #include "chrome/common/result_codes.h" | 22 #include "chrome/common/result_codes.h" |
| 22 | 23 |
| 23 // FactoryRegistry ------------------------------------------------------------- | 24 // FactoryRegistry ------------------------------------------------------------- |
| 24 | 25 |
| 25 namespace { | 26 namespace { |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 181 Delegate* delegate, | 182 Delegate* delegate, |
| 182 const GURL& url) | 183 const GURL& url) |
| 183 : render_view_host_(render_view_host), | 184 : render_view_host_(render_view_host), |
| 184 delegate_(delegate), | 185 delegate_(delegate), |
| 185 url_(url), | 186 url_(url), |
| 186 ALLOW_THIS_IN_INITIALIZER_LIST(peer_(new Peer(this))) { | 187 ALLOW_THIS_IN_INITIALIZER_LIST(peer_(new Peer(this))) { |
| 187 all_instances()->insert(this); | 188 all_instances()->insert(this); |
| 188 | 189 |
| 189 // Ensure the message service is initialized. | 190 // Ensure the message service is initialized. |
| 190 ExtensionMessageService::GetInstance(profile()->GetRequestContext())->Init(); | 191 ExtensionMessageService::GetInstance(profile()->GetRequestContext())->Init(); |
| 192 | |
| 193 // Notify the ExtensionProcessManager that the view was created. | |
| 194 ExtensionProcessManager* epm = profile()->GetExtensionProcessManager(); | |
| 195 epm->RegisterExtensionProcess(extension_id(), | |
| 196 render_view_host->process()->pid()); | |
|
Matt Perry
2009/07/14 21:17:48
indent += 2
| |
| 191 } | 197 } |
| 192 | 198 |
| 193 ExtensionFunctionDispatcher::~ExtensionFunctionDispatcher() { | 199 ExtensionFunctionDispatcher::~ExtensionFunctionDispatcher() { |
| 194 all_instances()->erase(this); | 200 all_instances()->erase(this); |
| 195 peer_->dispatcher_ = NULL; | 201 peer_->dispatcher_ = NULL; |
| 196 } | 202 } |
| 197 | 203 |
| 198 Browser* ExtensionFunctionDispatcher::GetBrowser() { | 204 Browser* ExtensionFunctionDispatcher::GetBrowser() { |
| 199 DCHECK(delegate_); | 205 DCHECK(delegate_); |
| 200 | 206 |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 230 } else { | 236 } else { |
| 231 NOTREACHED(); | 237 NOTREACHED(); |
| 232 base::KillProcess(render_view_host_->process()->process().handle(), | 238 base::KillProcess(render_view_host_->process()->process().handle(), |
| 233 ResultCodes::KILLED_BAD_MESSAGE, false); | 239 ResultCodes::KILLED_BAD_MESSAGE, false); |
| 234 } | 240 } |
| 235 } | 241 } |
| 236 | 242 |
| 237 Profile* ExtensionFunctionDispatcher::profile() { | 243 Profile* ExtensionFunctionDispatcher::profile() { |
| 238 return render_view_host_->process()->profile(); | 244 return render_view_host_->process()->profile(); |
| 239 } | 245 } |
| OLD | NEW |