Dmitry Gozman | b27efd1e | 2018-10-01 22:08:11 | [diff] [blame^] | 1 | // Copyright 2018 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 CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_RENDERER_CHANNEL_H_ |
| 6 | #define CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_RENDERER_CHANNEL_H_ |
| 7 | |
| 8 | #include "base/macros.h" |
| 9 | #include "content/common/content_export.h" |
| 10 | #include "third_party/blink/public/web/devtools_agent.mojom.h" |
| 11 | |
| 12 | namespace gfx { |
| 13 | class Point; |
| 14 | } |
| 15 | |
| 16 | namespace content { |
| 17 | |
| 18 | class DevToolsAgentHostImpl; |
| 19 | class DevToolsSession; |
| 20 | class RenderFrameHostImpl; |
| 21 | |
| 22 | // This class encapsulates a connection to blink::mojom::DevToolsAgent |
| 23 | // in the renderer. |
| 24 | // When the renderer changes, different DevToolsAgentHostImpl subclasses |
| 25 | // retrieve a new blink::mojom::DevToolsAgent pointer, and this channel |
| 26 | // starts using it for all existing and future sessions. |
| 27 | class CONTENT_EXPORT DevToolsRendererChannel { |
| 28 | public: |
| 29 | explicit DevToolsRendererChannel(DevToolsAgentHostImpl* owner); |
| 30 | ~DevToolsRendererChannel(); |
| 31 | |
| 32 | void SetRenderer(blink::mojom::DevToolsAgentAssociatedPtr agent_ptr, |
| 33 | int process_id, |
| 34 | RenderFrameHostImpl* frame_host); |
| 35 | void AttachSession(DevToolsSession* session); |
| 36 | void InspectElement(const gfx::Point& point); |
| 37 | |
| 38 | private: |
| 39 | DevToolsAgentHostImpl* owner_; |
| 40 | blink::mojom::DevToolsAgentAssociatedPtr agent_ptr_; |
| 41 | int process_id_; |
| 42 | RenderFrameHostImpl* frame_host_ = nullptr; |
| 43 | |
| 44 | DISALLOW_COPY_AND_ASSIGN(DevToolsRendererChannel); |
| 45 | }; |
| 46 | |
| 47 | } // namespace content |
| 48 | |
| 49 | #endif // CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_RENDERER_CHANNEL_H_ |