OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 EXTENSIONS_BROWSER_EXTENSION_FUNCTION_H_ | 5 #ifndef EXTENSIONS_BROWSER_EXTENSION_FUNCTION_H_ |
6 #define EXTENSIONS_BROWSER_EXTENSION_FUNCTION_H_ | 6 #define EXTENSIONS_BROWSER_EXTENSION_FUNCTION_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 public: | 93 public: |
94 enum ResponseType { | 94 enum ResponseType { |
95 // The function has succeeded. | 95 // The function has succeeded. |
96 SUCCEEDED, | 96 SUCCEEDED, |
97 // The function has failed. | 97 // The function has failed. |
98 FAILED, | 98 FAILED, |
99 // The input message is malformed. | 99 // The input message is malformed. |
100 BAD_MESSAGE | 100 BAD_MESSAGE |
101 }; | 101 }; |
102 | 102 |
103 typedef base::Callback<void(ResponseType type, | 103 using ResponseCallback = base::Callback<void( |
104 const base::ListValue& results, | 104 ResponseType type, |
105 const std::string& error)> ResponseCallback; | 105 const base::ListValue& results, |
| 106 const std::string& error, |
| 107 extensions::functions::HistogramValue histogram_value)>; |
106 | 108 |
107 ExtensionFunction(); | 109 ExtensionFunction(); |
108 | 110 |
109 virtual UIThreadExtensionFunction* AsUIThreadExtensionFunction(); | 111 virtual UIThreadExtensionFunction* AsUIThreadExtensionFunction(); |
110 virtual IOThreadExtensionFunction* AsIOThreadExtensionFunction(); | 112 virtual IOThreadExtensionFunction* AsIOThreadExtensionFunction(); |
111 | 113 |
112 // Returns true if the function has permission to run. | 114 // Returns true if the function has permission to run. |
113 // | 115 // |
114 // The default implementation is to check the Extension's permissions against | 116 // The default implementation is to check the Extension's permissions against |
115 // what this function requires to run, but some APIs may require finer | 117 // what this function requires to run, but some APIs may require finer |
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
656 static bool ValidationFailure(SyncIOThreadExtensionFunction* function); | 658 static bool ValidationFailure(SyncIOThreadExtensionFunction* function); |
657 | 659 |
658 private: | 660 private: |
659 // If you're hitting a compile error here due to "final" - great! You're | 661 // If you're hitting a compile error here due to "final" - great! You're |
660 // doing the right thing, you just need to extend IOThreadExtensionFunction | 662 // doing the right thing, you just need to extend IOThreadExtensionFunction |
661 // instead of SyncIOExtensionFunction. | 663 // instead of SyncIOExtensionFunction. |
662 ResponseAction Run() final; | 664 ResponseAction Run() final; |
663 }; | 665 }; |
664 | 666 |
665 #endif // EXTENSIONS_BROWSER_EXTENSION_FUNCTION_H_ | 667 #endif // EXTENSIONS_BROWSER_EXTENSION_FUNCTION_H_ |
OLD | NEW |