| 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 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <list> | 9 #include <list> |
| 10 | 10 |
| 11 #include "base/values.h" | 11 #include "base/values.h" |
| 12 #include "base/scoped_ptr.h" | 12 #include "base/scoped_ptr.h" |
| 13 #include "base/ref_counted.h" | 13 #include "base/ref_counted.h" |
| 14 #include "chrome/browser/extensions/extension_function_dispatcher.h" | 14 #include "chrome/browser/extensions/extension_function_dispatcher.h" |
| 15 | 15 |
| 16 class ExtensionFunctionDispatcher; | 16 class ExtensionFunctionDispatcher; |
| 17 class Profile; | 17 class Profile; |
| 18 class QuotaLimitHeuristic; | 18 class QuotaLimitHeuristic; |
| 19 | 19 |
| 20 #define EXTENSION_FUNCTION_VALIDATE(test) do { \ | 20 #define EXTENSION_FUNCTION_VALIDATE(test) do { \ |
| 21 if (!(test)) { \ | 21 if (!(test)) { \ |
| 22 bad_message_ = true; \ | 22 bad_message_ = true; \ |
| 23 return false; \ | 23 return false; \ |
| 24 } \ | 24 } \ |
| 25 } while (0) | 25 } while (0) |
| 26 | 26 |
| 27 #define EXTENSION_FUNCTION_ERROR(error) do { \ |
| 28 error_ = error; \ |
| 29 bad_message_ = true; \ |
| 30 return false; \ |
| 31 } while (0) |
| 32 |
| 27 #define DECLARE_EXTENSION_FUNCTION_NAME(name) \ | 33 #define DECLARE_EXTENSION_FUNCTION_NAME(name) \ |
| 28 public: static const char* function_name() { return name; } | 34 public: static const char* function_name() { return name; } |
| 29 | 35 |
| 30 // Abstract base class for extension functions the ExtensionFunctionDispatcher | 36 // Abstract base class for extension functions the ExtensionFunctionDispatcher |
| 31 // knows how to dispatch to. | 37 // knows how to dispatch to. |
| 32 // | 38 // |
| 33 // TODO(aa): This will have to become reference counted when we introduce | 39 // TODO(aa): This will have to become reference counted when we introduce |
| 34 // APIs that live beyond a single stack frame. | 40 // APIs that live beyond a single stack frame. |
| 35 class ExtensionFunction : public base::RefCounted<ExtensionFunction> { | 41 class ExtensionFunction : public base::RefCounted<ExtensionFunction> { |
| 36 public: | 42 public: |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 } | 197 } |
| 192 | 198 |
| 193 protected: | 199 protected: |
| 194 virtual ~SyncExtensionFunction() {} | 200 virtual ~SyncExtensionFunction() {} |
| 195 | 201 |
| 196 private: | 202 private: |
| 197 DISALLOW_COPY_AND_ASSIGN(SyncExtensionFunction); | 203 DISALLOW_COPY_AND_ASSIGN(SyncExtensionFunction); |
| 198 }; | 204 }; |
| 199 | 205 |
| 200 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_H_ | 206 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_H_ |
| OLD | NEW |