2017-05-03 04:29:04 +00:00
|
|
|
/**
|
|
|
|
* Copyright (c) 2016-present, Facebook, Inc.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* This source code is licensed under the BSD-style license found in the
|
|
|
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
|
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2017-10-03 12:45:31 +00:00
|
|
|
#include <functional>
|
2017-05-03 04:29:04 +00:00
|
|
|
#include <memory>
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
2017-10-03 12:45:31 +00:00
|
|
|
|
2017-05-03 04:29:04 +00:00
|
|
|
namespace facebook {
|
|
|
|
namespace react {
|
|
|
|
|
|
|
|
class IDestructible {
|
|
|
|
public:
|
|
|
|
virtual ~IDestructible() = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct InspectorPage {
|
|
|
|
const int id;
|
|
|
|
const std::string title;
|
|
|
|
};
|
|
|
|
|
|
|
|
class IRemoteConnection : public IDestructible {
|
|
|
|
public:
|
2017-11-27 15:05:22 +00:00
|
|
|
virtual ~IRemoteConnection() = 0;
|
2017-05-03 04:29:04 +00:00
|
|
|
virtual void onMessage(std::string message) = 0;
|
|
|
|
virtual void onDisconnect() = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
class ILocalConnection : public IDestructible {
|
|
|
|
public:
|
|
|
|
virtual ~ILocalConnection() = 0;
|
|
|
|
virtual void sendMessage(std::string message) = 0;
|
|
|
|
virtual void disconnect() = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
// Note: not destructible!
|
|
|
|
class IInspector {
|
|
|
|
public:
|
2017-11-27 15:05:20 +00:00
|
|
|
virtual void registerGlobalContext(const std::string& title, const std::function<bool()> &checkIsInspectedRemote, void* ctx) = 0;
|
|
|
|
virtual void unregisterGlobalContext(void* ctx) = 0;
|
2017-05-03 04:29:04 +00:00
|
|
|
|
|
|
|
virtual std::vector<InspectorPage> getPages() const = 0;
|
|
|
|
virtual std::unique_ptr<ILocalConnection> connect(int pageId, std::unique_ptr<IRemoteConnection> remote) = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|