Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(89)

Side by Side Diff: headless/public/util/in_memory_protocol_handler.h

Issue 2049363003: Adds support for headless chrome embedder mojo services (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef HEADLESS_PUBLIC_UTIL_IN_MEMORY_PROTOCOL_HANDLER_H_
6 #define HEADLESS_PUBLIC_UTIL_IN_MEMORY_PROTOCOL_HANDLER_H_
7
8 #include <map>
9
10 #include "net/url_request/url_request_job_factory.h"
11
12 namespace headless {
13
14 class InMemoryProtocolHandler
15 : public net::URLRequestJobFactory::ProtocolHandler {
16 public:
17 InMemoryProtocolHandler();
18 ~InMemoryProtocolHandler() override;
19
20 net::URLRequestJob* MaybeCreateJob(
21 net::URLRequest* request,
22 net::NetworkDelegate* network_delegate) const override;
23
24 struct Response {
25 Response() {}
26 Response(const std::string& data, const std::string& mime_type)
27 : data(data), mime_type(mime_type) {}
28
29 std::string data;
30 std::string mime_type;
31 };
32
33 void InsertResponse(const std::string& request_path,
34 const Response& response);
35
36 private:
37 const Response* GetResponse(const std::string& request_path) const;
38
39 std::map<std::string, Response> response_map_;
40
41 DISALLOW_COPY_AND_ASSIGN(InMemoryProtocolHandler);
42 };
43
44 } // namespace headless
45
46 #endif // HEADLESS_PUBLIC_UTIL_IN_MEMORY_PROTOCOL_HANDLER_H_
OLDNEW
« no previous file with comments | « headless/public/util/black_hole_protocol_handler.cc ('k') | headless/public/util/in_memory_protocol_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698