| Index: content/browser/devtools/devtools_browser_target.h
|
| diff --git a/content/browser/devtools/devtools_browser_target.h b/content/browser/devtools/devtools_browser_target.h
|
| index 4f34b0f75b00d835fe6535ca1e89998990cd4474..b7902852a879bf85b63b617a2e6b3c4c1db75bc4 100644
|
| --- a/content/browser/devtools/devtools_browser_target.h
|
| +++ b/content/browser/devtools/devtools_browser_target.h
|
| @@ -13,6 +13,7 @@
|
| #include "base/compiler_specific.h"
|
| #include "base/memory/scoped_ptr.h"
|
| #include "base/memory/weak_ptr.h"
|
| +#include "base/stl_util.h"
|
| #include "content/browser/devtools/devtools_protocol.h"
|
|
|
| namespace base {
|
| @@ -32,41 +33,22 @@ namespace content {
|
| // This class handles the "Browser" target for remote debugging.
|
| class DevToolsBrowserTarget {
|
| public:
|
| - typedef base::Callback<void(const std::string& method,
|
| - base::DictionaryValue* params)> Notifier;
|
| -
|
| - class DomainHandler {
|
| + class DomainHandler : public DevToolsProtocol::Handler {
|
| public:
|
| - typedef base::Callback<scoped_ptr<DevToolsProtocol::Response>(
|
| - DevToolsProtocol::Command* command)> CommandHandler;
|
| virtual ~DomainHandler();
|
|
|
| - // Returns the domain name for this handler.
|
| - std::string domain() { return domain_; }
|
| + // Overridden from Handler:
|
| + virtual scoped_ptr<DevToolsProtocol::Response> HandleCommand(
|
| + DevToolsProtocol::Command* command) OVERRIDE;
|
|
|
| - void RegisterCommandHandler(const std::string& command,
|
| - CommandHandler handler);
|
| + std::string domain() { return domain_; }
|
|
|
| protected:
|
| - explicit DomainHandler(const std::string& domain);
|
| -
|
| - // |params| and |error_out| ownership is transferred to the
|
| - // caller.
|
| - virtual scoped_ptr<DevToolsProtocol::Response> HandleCommand(
|
| - DevToolsProtocol::Command* command);
|
| -
|
| - // Sends notification to the client. Takes ownership of |params|.
|
| - void SendNotification(const std::string& method,
|
| - base::DictionaryValue* params);
|
| + DomainHandler(const DevToolsProtocol::Notifier& notifier,
|
| + const std::string& domain);
|
|
|
| private:
|
| - friend class DevToolsBrowserTarget;
|
| - void set_notifier(Notifier notifier) { notifier_ = notifier; }
|
| -
|
| std::string domain_;
|
| - Notifier notifier_;
|
| - typedef std::map<std::string, CommandHandler> CommandHandlers;
|
| - CommandHandlers command_handlers_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(DomainHandler);
|
| };
|
| @@ -83,10 +65,11 @@ class DevToolsBrowserTarget {
|
|
|
| std::string HandleMessage(const std::string& data);
|
|
|
| + DevToolsProtocol::Notifier GetNotifier();
|
| +
|
| private:
|
| - // Sends notification to the client. Passes ownership of |params|.
|
| - void SendNotification(const std::string& method,
|
| - base::DictionaryValue* params);
|
| +
|
| + void OnNotification(const std::string& message);
|
|
|
| base::MessageLoopProxy* const message_loop_proxy_;
|
| net::HttpServer* const http_server_;
|
| @@ -94,6 +77,7 @@ class DevToolsBrowserTarget {
|
|
|
| typedef std::map<std::string, DomainHandler*> DomainHandlerMap;
|
| DomainHandlerMap handlers_;
|
| + STLValueDeleter<DomainHandlerMap> handlers_deleter_;
|
| base::WeakPtrFactory<DevToolsBrowserTarget> weak_factory_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(DevToolsBrowserTarget);
|
|
|