| 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" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 scoped_ptr<Value> result_; | 64 scoped_ptr<Value> result_; |
| 65 | 65 |
| 66 // Any detailed error from the API. This should be populated by the derived | 66 // Any detailed error from the API. This should be populated by the derived |
| 67 // class before Run() returns. | 67 // class before Run() returns. |
| 68 std::string error_; | 68 std::string error_; |
| 69 | 69 |
| 70 // Any class that gets a malformed message should set this to true before | 70 // Any class that gets a malformed message should set this to true before |
| 71 // returning. The calling renderer process will be killed. | 71 // returning. The calling renderer process will be killed. |
| 72 bool bad_message_; | 72 bool bad_message_; |
| 73 | 73 |
| 74 // The dispatcher that will service this extension function call. |
| 75 ExtensionFunctionDispatcher* dispatcher_; |
| 76 |
| 74 private: | 77 private: |
| 75 ExtensionFunctionDispatcher* dispatcher_; | 78 // Id of js function to callback upon completion. -1 represents no callback. |
| 76 int callback_id_; | 79 int callback_id_; |
| 77 | 80 |
| 78 DISALLOW_COPY_AND_ASSIGN(ExtensionFunction); | 81 DISALLOW_COPY_AND_ASSIGN(ExtensionFunction); |
| 79 }; | 82 }; |
| 80 | 83 |
| 81 | 84 |
| 82 // A SyncExtensionFunction is an ExtensionFunction that runs synchronously | 85 // A SyncExtensionFunction is an ExtensionFunction that runs synchronously |
| 83 // *relative to the browser's UI thread*. Note that this has nothing to do with | 86 // *relative to the browser's UI thread*. Note that this has nothing to do with |
| 84 // running synchronously relative to the extension process. From the extension | 87 // running synchronously relative to the extension process. From the extension |
| 85 // process's point of view, the function is still asynchronous. | 88 // process's point of view, the function is still asynchronous. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 96 | 99 |
| 97 virtual void Run() { | 100 virtual void Run() { |
| 98 SendResponse(RunImpl()); | 101 SendResponse(RunImpl()); |
| 99 } | 102 } |
| 100 | 103 |
| 101 private: | 104 private: |
| 102 DISALLOW_COPY_AND_ASSIGN(SyncExtensionFunction); | 105 DISALLOW_COPY_AND_ASSIGN(SyncExtensionFunction); |
| 103 }; | 106 }; |
| 104 | 107 |
| 105 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_H_ | 108 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_H_ |
| OLD | NEW |