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/extensions/extension_function_dispatcher.h" | 5 #include "chrome/browser/extensions/extension_function_dispatcher.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/json/json_string_value_serializer.h" | 8 #include "base/json/json_string_value_serializer.h" |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 if (!function_ui) { | 364 if (!function_ui) { |
365 NOTREACHED(); | 365 NOTREACHED(); |
366 return; | 366 return; |
367 } | 367 } |
368 if (render_view_host) { | 368 if (render_view_host) { |
369 function_ui->SetRenderViewHost(render_view_host); | 369 function_ui->SetRenderViewHost(render_view_host); |
370 } else { | 370 } else { |
371 function_ui->SetRenderFrameHost(render_frame_host); | 371 function_ui->SetRenderFrameHost(render_frame_host); |
372 } | 372 } |
373 function_ui->set_dispatcher(AsWeakPtr()); | 373 function_ui->set_dispatcher(AsWeakPtr()); |
374 function_ui->set_context(browser_context_); | 374 function_ui->set_browser_context(browser_context_); |
375 function->set_include_incognito( | 375 function->set_include_incognito( |
376 ExtensionsBrowserClient::Get()->CanExtensionCrossIncognito( | 376 ExtensionsBrowserClient::Get()->CanExtensionCrossIncognito( |
377 extension, browser_context_)); | 377 extension, browser_context_)); |
378 | 378 |
379 if (!CheckPermissions(function.get(), extension, params, callback)) | 379 if (!CheckPermissions(function.get(), extension, params, callback)) |
380 return; | 380 return; |
381 | 381 |
382 ExtensionSystem* extension_system = ExtensionSystem::Get(browser_context_); | 382 ExtensionSystem* extension_system = ExtensionSystem::Get(browser_context_); |
383 extensions::QuotaService* quota = extension_system->quota_service(); | 383 extensions::QuotaService* quota = extension_system->quota_service(); |
384 std::string violation_error = quota->Assess(extension->id(), | 384 std::string violation_error = quota->Assess(extension->id(), |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
516 return function; | 516 return function; |
517 } | 517 } |
518 | 518 |
519 // static | 519 // static |
520 void ExtensionFunctionDispatcher::SendAccessDenied( | 520 void ExtensionFunctionDispatcher::SendAccessDenied( |
521 const ExtensionFunction::ResponseCallback& callback) { | 521 const ExtensionFunction::ResponseCallback& callback) { |
522 base::ListValue empty_list; | 522 base::ListValue empty_list; |
523 callback.Run(ExtensionFunction::FAILED, empty_list, | 523 callback.Run(ExtensionFunction::FAILED, empty_list, |
524 "Access to extension API denied."); | 524 "Access to extension API denied."); |
525 } | 525 } |
OLD | NEW |