Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(100)

Unified Diff: chrome/browser/extensions/extension_function_dispatcher.cc

Issue 10871034: Make all quota-exceeding messages in the storage API explain what the failure (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: update... the other error message Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/extension_function_dispatcher.cc
diff --git a/chrome/browser/extensions/extension_function_dispatcher.cc b/chrome/browser/extensions/extension_function_dispatcher.cc
index 566fd281a6e7a4e5e55445a84e9e95d35ed60af3..4ef84bde8c7f469ca54cb7c65e33a5574fa7e6df 100644
--- a/chrome/browser/extensions/extension_function_dispatcher.cc
+++ b/chrome/browser/extensions/extension_function_dispatcher.cc
@@ -152,12 +152,15 @@ void ExtensionFunctionDispatcher::DispatchOnIOThread(
extension_info_map->IsIncognitoEnabled(extension->id()));
ExtensionsQuotaService* quota = extension_info_map->GetQuotaService();
- if (quota->Assess(extension->id(), function, &params.arguments,
- base::TimeTicks::Now())) {
+ std::string violation_error = quota->Assess(extension->id(),
+ function,
+ &params.arguments,
+ base::TimeTicks::Now());
+ if (violation_error.empty()) {
function->Run();
LogSuccess(extension, params);
} else {
- function->OnQuotaExceeded();
+ function->OnQuotaExceeded(violation_error);
LogFailure(extension, params.name, kQuotaExceeded);
}
}
@@ -209,15 +212,18 @@ void ExtensionFunctionDispatcher::Dispatch(
function->set_include_incognito(service->CanCrossIncognito(extension));
ExtensionsQuotaService* quota = service->quota_service();
- if (quota->Assess(extension->id(), function, &params.arguments,
- base::TimeTicks::Now())) {
+ std::string violation_error = quota->Assess(extension->id(),
+ function,
+ &params.arguments,
+ base::TimeTicks::Now());
+ if (violation_error.empty()) {
// See crbug.com/39178.
ExternalProtocolHandler::PermitLaunchUrl();
function->Run();
LogSuccess(extension, params);
} else {
- function->OnQuotaExceeded();
+ function->OnQuotaExceeded(violation_error);
LogFailure(extension, params.name, kQuotaExceeded);
}
« no previous file with comments | « chrome/browser/extensions/extension_function.cc ('k') | chrome/browser/extensions/extensions_quota_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698