| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_RENDERER_SCRIPT_INJECTION_CALLBACK_H_ | 5 #ifndef EXTENSIONS_RENDERER_SCRIPT_INJECTION_CALLBACK_H_ |
| 6 #define EXTENSIONS_RENDERER_SCRIPT_INJECTION_CALLBACK_H_ | 6 #define EXTENSIONS_RENDERER_SCRIPT_INJECTION_CALLBACK_H_ |
| 7 | 7 |
| 8 #include <vector> |
| 9 |
| 8 #include "base/callback.h" | 10 #include "base/callback.h" |
| 9 #include "base/macros.h" | 11 #include "base/macros.h" |
| 10 #include "third_party/WebKit/public/web/WebScriptExecutionCallback.h" | 12 #include "third_party/WebKit/public/web/WebScriptExecutionCallback.h" |
| 11 #include "v8/include/v8.h" | 13 #include "v8/include/v8.h" |
| 12 | 14 |
| 13 namespace blink { | |
| 14 template<typename T> class WebVector; | |
| 15 } | |
| 16 | |
| 17 namespace extensions { | 15 namespace extensions { |
| 18 | 16 |
| 19 // A wrapper around a callback to notify a script injection when injection | 17 // A wrapper around a callback to notify a script injection when injection |
| 20 // completes. | 18 // completes. |
| 21 // This class manages its own lifetime. | 19 // This class manages its own lifetime. |
| 22 class ScriptInjectionCallback : public blink::WebScriptExecutionCallback { | 20 class ScriptInjectionCallback : public blink::WebScriptExecutionCallback { |
| 23 public: | 21 public: |
| 24 using CompleteCallback = | 22 using CompleteCallback = |
| 25 base::Callback<void( | 23 base::Callback<void(const std::vector<v8::Local<v8::Value>>& result)>; |
| 26 const blink::WebVector<v8::Local<v8::Value>>& result)>; | |
| 27 | 24 |
| 28 ScriptInjectionCallback(const CompleteCallback& injection_completed_callback); | 25 ScriptInjectionCallback(const CompleteCallback& injection_completed_callback); |
| 29 ~ScriptInjectionCallback() override; | 26 ~ScriptInjectionCallback() override; |
| 30 | 27 |
| 31 void completed( | 28 void completed( |
| 32 const blink::WebVector<v8::Local<v8::Value> >& result) override; | 29 const blink::WebVector<v8::Local<v8::Value> >& result) override; |
| 33 | 30 |
| 34 private: | 31 private: |
| 35 CompleteCallback injection_completed_callback_; | 32 CompleteCallback injection_completed_callback_; |
| 36 | 33 |
| 37 DISALLOW_COPY_AND_ASSIGN(ScriptInjectionCallback); | 34 DISALLOW_COPY_AND_ASSIGN(ScriptInjectionCallback); |
| 38 }; | 35 }; |
| 39 | 36 |
| 40 } // namespace extensions | 37 } // namespace extensions |
| 41 | 38 |
| 42 #endif // EXTENSIONS_RENDERER_SCRIPT_INJECTION_CALLBACK_H_ | 39 #endif // EXTENSIONS_RENDERER_SCRIPT_INJECTION_CALLBACK_H_ |
| OLD | NEW |