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" |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 ExtensionFunctionDispatcher::ExtensionFunctionDispatcher( | 182 ExtensionFunctionDispatcher::ExtensionFunctionDispatcher( |
183 RenderViewHost* render_view_host, | 183 RenderViewHost* render_view_host, |
184 Delegate* delegate, | 184 Delegate* delegate, |
185 const GURL& url) | 185 const GURL& url) |
186 : render_view_host_(render_view_host), | 186 : render_view_host_(render_view_host), |
187 delegate_(delegate), | 187 delegate_(delegate), |
188 url_(url), | 188 url_(url), |
189 ALLOW_THIS_IN_INITIALIZER_LIST(peer_(new Peer(this))) { | 189 ALLOW_THIS_IN_INITIALIZER_LIST(peer_(new Peer(this))) { |
190 all_instances()->insert(this); | 190 all_instances()->insert(this); |
191 | 191 |
192 // Ensure the message service is initialized. | |
193 ExtensionMessageService::GetInstance(profile()->GetRequestContext())->Init(); | |
194 | |
195 // Notify the ExtensionProcessManager that the view was created. | 192 // Notify the ExtensionProcessManager that the view was created. |
196 ExtensionProcessManager* epm = profile()->GetExtensionProcessManager(); | 193 ExtensionProcessManager* epm = profile()->GetExtensionProcessManager(); |
197 epm->RegisterExtensionProcess(extension_id(), | 194 epm->RegisterExtensionProcess(extension_id(), |
198 render_view_host->process()->pid()); | 195 render_view_host->process()->pid()); |
199 } | 196 } |
200 | 197 |
201 ExtensionFunctionDispatcher::~ExtensionFunctionDispatcher() { | 198 ExtensionFunctionDispatcher::~ExtensionFunctionDispatcher() { |
202 all_instances()->erase(this); | 199 all_instances()->erase(this); |
203 peer_->dispatcher_ = NULL; | 200 peer_->dispatcher_ = NULL; |
204 } | 201 } |
205 | 202 |
206 Browser* ExtensionFunctionDispatcher::GetBrowser() { | 203 Browser* ExtensionFunctionDispatcher::GetBrowser() { |
207 DCHECK(delegate_); | 204 DCHECK(delegate_); |
208 | 205 |
(...skipping 29 matching lines...) Expand all Loading... |
238 } else { | 235 } else { |
239 NOTREACHED(); | 236 NOTREACHED(); |
240 base::KillProcess(render_view_host_->process()->process().handle(), | 237 base::KillProcess(render_view_host_->process()->process().handle(), |
241 ResultCodes::KILLED_BAD_MESSAGE, false); | 238 ResultCodes::KILLED_BAD_MESSAGE, false); |
242 } | 239 } |
243 } | 240 } |
244 | 241 |
245 Profile* ExtensionFunctionDispatcher::profile() { | 242 Profile* ExtensionFunctionDispatcher::profile() { |
246 return render_view_host_->process()->profile(); | 243 return render_view_host_->process()->profile(); |
247 } | 244 } |
OLD | NEW |