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 | 9 |
10 #include "base/values.h" | 10 #include "base/values.h" |
11 #include "base/scoped_ptr.h" | 11 #include "base/scoped_ptr.h" |
12 | 12 |
13 class ExtensionFunctionDispatcher; | 13 class ExtensionFunctionDispatcher; |
14 class Profile; | 14 class Profile; |
15 | 15 |
16 #define EXTENSION_FUNCTION_VALIDATE(test) do { \ | 16 #define EXTENSION_FUNCTION_VALIDATE(test) do { \ |
17 if (!test) { \ | 17 if (!(test)) { \ |
18 bad_message_ = true; \ | 18 bad_message_ = true; \ |
19 return false; \ | 19 return false; \ |
20 } \ | 20 } \ |
21 } while (0) | 21 } while (0) |
22 | 22 |
23 // Base class for an extension function. | 23 // Base class for an extension function. |
24 // TODO(aa): This will have to become reference counted when we introduce APIs | 24 // TODO(aa): This will have to become reference counted when we introduce APIs |
25 // that live beyond a single stack frame. | 25 // that live beyond a single stack frame. |
26 class ExtensionFunction { | 26 class ExtensionFunction { |
27 public: | 27 public: |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 | 99 |
100 virtual void Run() { | 100 virtual void Run() { |
101 SendResponse(RunImpl()); | 101 SendResponse(RunImpl()); |
102 } | 102 } |
103 | 103 |
104 private: | 104 private: |
105 DISALLOW_COPY_AND_ASSIGN(SyncExtensionFunction); | 105 DISALLOW_COPY_AND_ASSIGN(SyncExtensionFunction); |
106 }; | 106 }; |
107 | 107 |
108 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_H_ | 108 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_H_ |
OLD | NEW |