| 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 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 } | 238 } |
| 239 | 239 |
| 240 Browser* ExtensionFunctionDispatcher::GetBrowser() { | 240 Browser* ExtensionFunctionDispatcher::GetBrowser() { |
| 241 return delegate_->GetBrowser(); | 241 return delegate_->GetBrowser(); |
| 242 } | 242 } |
| 243 | 243 |
| 244 ExtensionHost* ExtensionFunctionDispatcher::GetExtensionHost() { | 244 ExtensionHost* ExtensionFunctionDispatcher::GetExtensionHost() { |
| 245 return delegate_->GetExtensionHost(); | 245 return delegate_->GetExtensionHost(); |
| 246 } | 246 } |
| 247 | 247 |
| 248 Extension* ExtensionFunctionDispatcher::GetExtension() { |
| 249 ExtensionsService* service = profile()->GetExtensionsService(); |
| 250 DCHECK(service); |
| 251 |
| 252 Extension* extension = service->GetExtensionById(extension_id()); |
| 253 DCHECK(extension); |
| 254 |
| 255 return extension; |
| 256 } |
| 257 |
| 248 void ExtensionFunctionDispatcher::HandleRequest(const std::string& name, | 258 void ExtensionFunctionDispatcher::HandleRequest(const std::string& name, |
| 249 const std::string& args, | 259 const std::string& args, |
| 250 int request_id, | 260 int request_id, |
| 251 bool has_callback) { | 261 bool has_callback) { |
| 252 scoped_refptr<ExtensionFunction> function( | 262 scoped_refptr<ExtensionFunction> function( |
| 253 FactoryRegistry::instance()->NewFunction(name)); | 263 FactoryRegistry::instance()->NewFunction(name)); |
| 254 function->set_dispatcher_peer(peer_); | 264 function->set_dispatcher_peer(peer_); |
| 255 function->SetArgs(args); | 265 function->SetArgs(args); |
| 256 function->set_request_id(request_id); | 266 function->set_request_id(request_id); |
| 257 function->set_has_callback(has_callback); | 267 function->set_has_callback(has_callback); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 274 } else { | 284 } else { |
| 275 NOTREACHED(); | 285 NOTREACHED(); |
| 276 base::KillProcess(render_view_host_->process()->process().handle(), | 286 base::KillProcess(render_view_host_->process()->process().handle(), |
| 277 ResultCodes::KILLED_BAD_MESSAGE, false); | 287 ResultCodes::KILLED_BAD_MESSAGE, false); |
| 278 } | 288 } |
| 279 } | 289 } |
| 280 | 290 |
| 281 Profile* ExtensionFunctionDispatcher::profile() { | 291 Profile* ExtensionFunctionDispatcher::profile() { |
| 282 return render_view_host_->process()->profile(); | 292 return render_view_host_->process()->profile(); |
| 283 } | 293 } |
| OLD | NEW |