| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 HEADLESS_PUBLIC_INTERNAL_MESSAGE_DISPATCHER_H_ | 5 #ifndef HEADLESS_PUBLIC_INTERNAL_MESSAGE_DISPATCHER_H_ |
| 6 #define HEADLESS_PUBLIC_INTERNAL_MESSAGE_DISPATCHER_H_ | 6 #define HEADLESS_PUBLIC_INTERNAL_MESSAGE_DISPATCHER_H_ |
| 7 | 7 |
| 8 #include <memory> |
| 9 |
| 10 #include "base/callback_forward.h" |
| 11 |
| 12 namespace base { |
| 13 class Value; |
| 14 } |
| 15 |
| 8 namespace headless { | 16 namespace headless { |
| 9 namespace internal { | 17 namespace internal { |
| 10 | 18 |
| 11 // An internal interface for sending DevTools messages from the domain agents. | 19 // An internal interface for sending DevTools messages from the domain agents. |
| 12 class MessageDispatcher { | 20 class MessageDispatcher { |
| 13 public: | 21 public: |
| 14 virtual void SendMessage( | 22 virtual void SendMessage( |
| 15 const char* method, | 23 const char* method, |
| 16 std::unique_ptr<base::Value> params, | 24 std::unique_ptr<base::Value> params, |
| 17 base::Callback<void(const base::Value&)> callback) = 0; | 25 base::Callback<void(const base::Value&)> callback) = 0; |
| 18 virtual void SendMessage(const char* method, | 26 virtual void SendMessage(const char* method, |
| 19 std::unique_ptr<base::Value> params, | 27 std::unique_ptr<base::Value> params, |
| 20 base::Callback<void()> callback) = 0; | 28 base::Closure callback) = 0; |
| 21 virtual void SendMessage( | |
| 22 const char* method, | |
| 23 base::Callback<void(const base::Value&)> callback) = 0; | |
| 24 virtual void SendMessage(const char* method, | |
| 25 base::Callback<void()> callback) = 0; | |
| 26 | 29 |
| 27 virtual void RegisterEventHandler( | 30 virtual void RegisterEventHandler( |
| 28 const char* method, | 31 const char* method, |
| 29 base::Callback<void(const base::Value&)> callback) = 0; | 32 base::Callback<void(const base::Value&)> callback) = 0; |
| 33 |
| 34 protected: |
| 35 virtual ~MessageDispatcher() {} |
| 30 }; | 36 }; |
| 31 | 37 |
| 32 } // namespace internal | 38 } // namespace internal |
| 33 } // namespace headless | 39 } // namespace headless |
| 34 | 40 |
| 35 #endif // HEADLESS_PUBLIC_INTERNAL_MESSAGE_DISPATCHER_H_ | 41 #endif // HEADLESS_PUBLIC_INTERNAL_MESSAGE_DISPATCHER_H_ |
| OLD | NEW |