| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <map> | 7 #include <map> |
| 8 | 8 |
| 9 #include "base/process_util.h" | 9 #include "base/process_util.h" |
| 10 #include "base/singleton.h" | 10 #include "base/singleton.h" |
| (...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 function->set_extension_id(extension_id()); | 443 function->set_extension_id(extension_id()); |
| 444 function->SetArgs(¶ms.arguments); | 444 function->SetArgs(¶ms.arguments); |
| 445 function->set_source_url(params.source_url); | 445 function->set_source_url(params.source_url); |
| 446 function->set_request_id(params.request_id); | 446 function->set_request_id(params.request_id); |
| 447 function->set_has_callback(params.has_callback); | 447 function->set_has_callback(params.has_callback); |
| 448 function->set_user_gesture(params.user_gesture); | 448 function->set_user_gesture(params.user_gesture); |
| 449 ExtensionsService* service = profile()->GetExtensionsService(); | 449 ExtensionsService* service = profile()->GetExtensionsService(); |
| 450 DCHECK(service); | 450 DCHECK(service); |
| 451 const Extension* extension = service->GetExtensionById(extension_id(), false); | 451 const Extension* extension = service->GetExtensionById(extension_id(), false); |
| 452 DCHECK(extension); | 452 DCHECK(extension); |
| 453 function->set_include_incognito(service->IsIncognitoEnabled(extension) && | 453 function->set_include_incognito(service->CanCrossIncognito(extension)); |
| 454 !extension->incognito_split_mode()); | |
| 455 | 454 |
| 456 if (!service->ExtensionBindingsAllowed(function->source_url()) || | 455 if (!service->ExtensionBindingsAllowed(function->source_url()) || |
| 457 !extension->HasApiPermission(function->name())) { | 456 !extension->HasApiPermission(function->name())) { |
| 458 render_view_host_->BlockExtensionRequest(function->request_id()); | 457 render_view_host_->BlockExtensionRequest(function->request_id()); |
| 459 return; | 458 return; |
| 460 } | 459 } |
| 461 | 460 |
| 462 ExtensionsQuotaService* quota = service->quota_service(); | 461 ExtensionsQuotaService* quota = service->quota_service(); |
| 463 if (quota->Assess(extension_id(), function, ¶ms.arguments, | 462 if (quota->Assess(extension_id(), function, ¶ms.arguments, |
| 464 base::TimeTicks::Now())) { | 463 base::TimeTicks::Now())) { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 488 } else { | 487 } else { |
| 489 NOTREACHED(); | 488 NOTREACHED(); |
| 490 base::KillProcess(render_view_host_->process()->GetHandle(), | 489 base::KillProcess(render_view_host_->process()->GetHandle(), |
| 491 ResultCodes::KILLED_BAD_MESSAGE, false); | 490 ResultCodes::KILLED_BAD_MESSAGE, false); |
| 492 } | 491 } |
| 493 } | 492 } |
| 494 | 493 |
| 495 Profile* ExtensionFunctionDispatcher::profile() { | 494 Profile* ExtensionFunctionDispatcher::profile() { |
| 496 return profile_; | 495 return profile_; |
| 497 } | 496 } |
| OLD | NEW |