[refactor] More post-NSS WebCrypto cleanups (utility functions).
[chromium-blink-merge.git] / content / browser / devtools / protocol / io_handler.h
blobd6ae25baaa410572f540af46b86e94bd88d154e2
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
3 // found in the LICENSE file.
5 #ifndef CONTENT_BROWSER_DEVTOOLS_PROTOCOL_IO_HANDLER_H_
6 #define CONTENT_BROWSER_DEVTOOLS_PROTOCOL_IO_HANDLER_H_
8 #include "base/memory/weak_ptr.h"
9 #include "content/browser/devtools/protocol/devtools_protocol_dispatcher.h"
11 namespace base {
12 class RefCountedString;
15 namespace content {
16 namespace devtools {
17 class DevToolsIOContext;
19 namespace io {
21 class IOHandler {
22 public:
23 using Response = DevToolsProtocolClient::Response;
25 explicit IOHandler(DevToolsIOContext* io_context);
26 ~IOHandler();
28 void SetClient(scoped_ptr<Client> client);
30 // Protocol methods.
31 Response Read(DevToolsCommandId command_id, const std::string& handle,
32 const int* offset, const int* max_size);
33 Response Close(const std::string& handle);
35 private:
36 void ReadComplete(DevToolsCommandId command_id,
37 const scoped_refptr<base::RefCountedString>& data, int status);
39 scoped_ptr<Client> client_;
40 DevToolsIOContext* io_context_;
41 base::WeakPtrFactory<IOHandler> weak_factory_;
43 DISALLOW_COPY_AND_ASSIGN(IOHandler);
46 } // namespace io
47 } // namespace devtools
48 } // namespace content
50 #endif // CONTENT_BROWSER_DEVTOOLS_PROTOCOL_TRACING_HANDLER_H_