| 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.h" | 5 #include "chrome/browser/extensions/extension_function.h" |
| 6 | 6 |
| 7 #include "base/json/json_writer.h" | 7 #include "base/json/json_writer.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "chrome/browser/extensions/extension_function_dispatcher.h" | 9 #include "chrome/browser/extensions/extension_function_dispatcher.h" |
| 10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 } | 76 } |
| 77 | 77 |
| 78 UIThreadExtensionFunction* ExtensionFunction::AsUIThreadExtensionFunction() { | 78 UIThreadExtensionFunction* ExtensionFunction::AsUIThreadExtensionFunction() { |
| 79 return NULL; | 79 return NULL; |
| 80 } | 80 } |
| 81 | 81 |
| 82 IOThreadExtensionFunction* ExtensionFunction::AsIOThreadExtensionFunction() { | 82 IOThreadExtensionFunction* ExtensionFunction::AsIOThreadExtensionFunction() { |
| 83 return NULL; | 83 return NULL; |
| 84 } | 84 } |
| 85 | 85 |
| 86 bool ExtensionFunction::HasPermission() { |
| 87 return extension_->HasAPIPermission(name_); |
| 88 } |
| 89 |
| 86 void ExtensionFunction::OnQuotaExceeded() { | 90 void ExtensionFunction::OnQuotaExceeded() { |
| 87 error_ = QuotaLimitHeuristic::kGenericOverQuotaError; | 91 error_ = QuotaLimitHeuristic::kGenericOverQuotaError; |
| 88 SendResponse(false); | 92 SendResponse(false); |
| 89 } | 93 } |
| 90 | 94 |
| 91 void ExtensionFunction::SetArgs(const base::ListValue* args) { | 95 void ExtensionFunction::SetArgs(const base::ListValue* args) { |
| 92 DCHECK(!args_.get()); // Should only be called once. | 96 DCHECK(!args_.get()); // Should only be called once. |
| 93 args_.reset(args->DeepCopy()); | 97 args_.reset(args->DeepCopy()); |
| 94 } | 98 } |
| 95 | 99 |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 | 307 |
| 304 SyncIOThreadExtensionFunction::SyncIOThreadExtensionFunction() { | 308 SyncIOThreadExtensionFunction::SyncIOThreadExtensionFunction() { |
| 305 } | 309 } |
| 306 | 310 |
| 307 SyncIOThreadExtensionFunction::~SyncIOThreadExtensionFunction() { | 311 SyncIOThreadExtensionFunction::~SyncIOThreadExtensionFunction() { |
| 308 } | 312 } |
| 309 | 313 |
| 310 void SyncIOThreadExtensionFunction::Run() { | 314 void SyncIOThreadExtensionFunction::Run() { |
| 311 SendResponse(RunImpl()); | 315 SendResponse(RunImpl()); |
| 312 } | 316 } |
| OLD | NEW |