| 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..2adea6151f34226daf25798d8558d7ba8ba3bff3 100644
|
| --- a/content/browser/devtools/devtools_browser_target.h
|
| +++ b/content/browser/devtools/devtools_browser_target.h
|
| @@ -9,18 +9,16 @@
|
| #include <string>
|
|
|
| #include "base/basictypes.h"
|
| -#include "base/callback.h"
|
| #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 {
|
| -
|
| class DictionaryValue;
|
| class MessageLoopProxy;
|
| class Value;
|
| -
|
| } // namespace base
|
|
|
| namespace net {
|
| @@ -32,45 +30,6 @@ 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 {
|
| - 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_; }
|
| -
|
| - void RegisterCommandHandler(const std::string& command,
|
| - CommandHandler handler);
|
| -
|
| - 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);
|
| -
|
| - 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);
|
| - };
|
| -
|
| DevToolsBrowserTarget(base::MessageLoopProxy* message_loop_proxy,
|
| net::HttpServer* server,
|
| int connection_id);
|
| @@ -79,21 +38,21 @@ class DevToolsBrowserTarget {
|
| int connection_id() const { return connection_id_; }
|
|
|
| // Takes ownership of |handler|.
|
| - void RegisterDomainHandler(DomainHandler* handler);
|
| + void RegisterDomainHandler(const std::string& domain,
|
| + DevToolsProtocol::Handler* handler);
|
|
|
| std::string HandleMessage(const std::string& data);
|
|
|
| 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_;
|
| const int connection_id_;
|
|
|
| - typedef std::map<std::string, DomainHandler*> DomainHandlerMap;
|
| + typedef std::map<std::string, DevToolsProtocol::Handler*> DomainHandlerMap;
|
| DomainHandlerMap handlers_;
|
| + STLValueDeleter<DomainHandlerMap> handlers_deleter_;
|
| base::WeakPtrFactory<DevToolsBrowserTarget> weak_factory_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(DevToolsBrowserTarget);
|
|
|