OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef COMPONENTS_UI_DEVTOOLS_DEVTOOLS_SERVER_H_ | 5 #ifndef COMPONENTS_UI_DEVTOOLS_DEVTOOLS_SERVER_H_ |
6 #define COMPONENTS_UI_DEVTOOLS_DEVTOOLS_SERVER_H_ | 6 #define COMPONENTS_UI_DEVTOOLS_DEVTOOLS_SERVER_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "base/single_thread_task_runner.h" | 11 #include "base/single_thread_task_runner.h" |
12 #include "base/threading/thread.h" | 12 #include "base/threading/thread.h" |
13 #include "components/ui_devtools/DOM.h" | 13 #include "components/ui_devtools/DOM.h" |
14 #include "components/ui_devtools/Forward.h" | 14 #include "components/ui_devtools/Forward.h" |
15 #include "components/ui_devtools/Protocol.h" | 15 #include "components/ui_devtools/Protocol.h" |
16 #include "components/ui_devtools/devtools_client.h" | 16 #include "components/ui_devtools/devtools_client.h" |
| 17 #include "components/ui_devtools/devtools_export.h" |
17 #include "components/ui_devtools/string_util.h" | 18 #include "components/ui_devtools/string_util.h" |
18 #include "net/server/http_server.h" | 19 #include "net/server/http_server.h" |
19 | 20 |
20 namespace ui { | 21 namespace ui_devtools { |
21 namespace devtools { | |
22 | 22 |
23 class UiDevToolsServer : public net::HttpServer::Delegate { | 23 class UI_DEVTOOLS_EXPORT UiDevToolsServer |
| 24 : public NON_EXPORTED_BASE(net::HttpServer::Delegate) { |
24 public: | 25 public: |
25 ~UiDevToolsServer() override; | 26 ~UiDevToolsServer() override; |
26 | 27 |
27 // Returns an empty unique_ptr if ui devtools flag isn't enabled or if a | 28 // Returns an empty unique_ptr if ui devtools flag isn't enabled or if a |
28 // server instance has already been created. | 29 // server instance has already been created. |
29 static std::unique_ptr<UiDevToolsServer> Create( | 30 static std::unique_ptr<UiDevToolsServer> Create( |
30 scoped_refptr<base::SingleThreadTaskRunner> io_thread_task_runner); | 31 scoped_refptr<base::SingleThreadTaskRunner> io_thread_task_runner); |
31 | 32 |
32 // Returns a list of attached UiDevToolsClient name + URL | 33 // Returns a list of attached UiDevToolsClient name + URL |
33 using NameUrlPair = std::pair<std::string, std::string>; | 34 using NameUrlPair = std::pair<std::string, std::string>; |
(...skipping 27 matching lines...) Expand all Loading... |
61 std::unique_ptr<net::HttpServer> server_; | 62 std::unique_ptr<net::HttpServer> server_; |
62 scoped_refptr<base::SingleThreadTaskRunner> io_thread_task_runner_; | 63 scoped_refptr<base::SingleThreadTaskRunner> io_thread_task_runner_; |
63 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; | 64 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; |
64 | 65 |
65 // The server (owned by ash for now) | 66 // The server (owned by ash for now) |
66 static UiDevToolsServer* devtools_server_; | 67 static UiDevToolsServer* devtools_server_; |
67 | 68 |
68 DISALLOW_COPY_AND_ASSIGN(UiDevToolsServer); | 69 DISALLOW_COPY_AND_ASSIGN(UiDevToolsServer); |
69 }; | 70 }; |
70 | 71 |
71 } // namespace devtools | 72 } // namespace ui_devtools |
72 } // namespace ui | |
73 | 73 |
74 #endif // COMPONENTS_UI_DEVTOOLS_DEVTOOLS_SERVER_H_ | 74 #endif // COMPONENTS_UI_DEVTOOLS_DEVTOOLS_SERVER_H_ |
OLD | NEW |