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 COMPONENTS_DEVTOOLS_SERVICE_DEVTOOLS_SERVICE_H_
6 #define COMPONENTS_DEVTOOLS_SERVICE_DEVTOOLS_SERVICE_H_
8 #include "base/macros.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "components/devtools_service/public/interfaces/devtools_service.mojom.h"
11 #include "mojo/common/weak_binding_set.h"
14 class ApplicationImpl
;
17 namespace devtools_service
{
19 class DevToolsHttpServer
;
20 class DevToolsRegistryImpl
;
22 // DevToolsService is the central control. It manages the communication with
23 // DevTools agents (e.g., Web page renderers). It also starts an HTTP server to
24 // speak the Chrome remote debugging protocol.
25 class DevToolsService
: public DevToolsCoordinator
{
27 // Doesn't take ownership of |application|, which must outlive this object.
28 explicit DevToolsService(mojo::ApplicationImpl
* application
);
29 ~DevToolsService() override
;
31 void BindToCoordinatorRequest(
32 mojo::InterfaceRequest
<DevToolsCoordinator
> request
);
34 mojo::ApplicationImpl
* application() { return application_
; }
36 bool IsInitialized() const { return !!http_server_
; }
38 // Non-null if initialized.
39 DevToolsRegistryImpl
* registry() { return registry_
.get(); }
42 // DevToolsCoordinator implementation.
43 void Initialize(uint16_t remote_debugging_port
) override
;
45 // Not owned by this object.
46 mojo::ApplicationImpl
* const application_
;
48 mojo::WeakBindingSet
<DevToolsCoordinator
> coordinator_bindings_
;
50 scoped_ptr
<DevToolsHttpServer
> http_server_
;
51 scoped_ptr
<DevToolsRegistryImpl
> registry_
;
53 DISALLOW_COPY_AND_ASSIGN(DevToolsService
);
56 } // namespace devtools_service
58 #endif // COMPONENTS_DEVTOOLS_SERVICE_DEVTOOLS_SERVICE_H_