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

Side by Side Diff: content/browser/devtools/devtools_agent_host_impl.h

Issue 2289773002: Revert of DevTools: merge devtools target with devtools host, part 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 3 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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_AGENT_HOST_IMPL_H_ 5 #ifndef CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_AGENT_HOST_IMPL_H_
6 #define CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_AGENT_HOST_IMPL_H_ 6 #define CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_AGENT_HOST_IMPL_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <string> 10 #include <string>
(...skipping 16 matching lines...) Expand all
27 // Describes interface for managing devtools agents from the browser process. 27 // Describes interface for managing devtools agents from the browser process.
28 class CONTENT_EXPORT DevToolsAgentHostImpl : public DevToolsAgentHost, 28 class CONTENT_EXPORT DevToolsAgentHostImpl : public DevToolsAgentHost,
29 public DevToolsProtocolDelegate { 29 public DevToolsProtocolDelegate {
30 public: 30 public:
31 // Informs the hosted agent that a client host has attached. 31 // Informs the hosted agent that a client host has attached.
32 virtual void Attach() = 0; 32 virtual void Attach() = 0;
33 33
34 // Informs the hosted agent that a client host has detached. 34 // Informs the hosted agent that a client host has detached.
35 virtual void Detach() = 0; 35 virtual void Detach() = 0;
36 36
37 // Opens the inspector for this host.
38 bool Inspect(BrowserContext* browser_context);
39
37 // DevToolsAgentHost implementation. 40 // DevToolsAgentHost implementation.
38 bool AttachClient(DevToolsAgentHostClient* client) override; 41 bool AttachClient(DevToolsAgentHostClient* client) override;
39 void ForceAttachClient(DevToolsAgentHostClient* client) override; 42 void ForceAttachClient(DevToolsAgentHostClient* client) override;
40 bool DetachClient(DevToolsAgentHostClient* client) override; 43 bool DetachClient(DevToolsAgentHostClient* client) override;
41 bool DispatchProtocolMessage(DevToolsAgentHostClient* client, 44 bool DispatchProtocolMessage(DevToolsAgentHostClient* client,
42 const std::string& message) override; 45 const std::string& message) override;
46
43 bool IsAttached() override; 47 bool IsAttached() override;
44 void InspectElement(DevToolsAgentHostClient* client, int x, int y) override; 48 void InspectElement(DevToolsAgentHostClient* client, int x, int y) override;
45 std::string GetId() override; 49 std::string GetId() override;
46 std::string GetParentId() override;
47 std::string GetDescription() override;
48 void SetDescriptionOverride(const std::string& description) override;
49 GURL GetFaviconURL() override;
50 base::TimeTicks GetLastActivityTime() override;
51 BrowserContext* GetBrowserContext() override; 50 BrowserContext* GetBrowserContext() override;
52 WebContents* GetWebContents() override; 51 WebContents* GetWebContents() override;
53 void DisconnectWebContents() override; 52 void DisconnectWebContents() override;
54 void ConnectWebContents(WebContents* wc) override; 53 void ConnectWebContents(WebContents* wc) override;
55 bool Inspect() override;
56 54
57 // DevToolsProtocolDelegate implementation. 55 // DevToolsProtocolDelegate implementation.
58 void SendProtocolResponse(int session_id, 56 void SendProtocolResponse(int session_id,
59 const std::string& message) override; 57 const std::string& message) override;
60 void SendProtocolNotification(const std::string& message) override; 58 void SendProtocolNotification(const std::string& message) override;
61 59
62 protected: 60 protected:
63 DevToolsAgentHostImpl(const std::string& id); 61 DevToolsAgentHostImpl();
64 ~DevToolsAgentHostImpl() override; 62 ~DevToolsAgentHostImpl() override;
65 63
66 virtual bool DispatchProtocolMessage(const std::string& message) = 0; 64 virtual bool DispatchProtocolMessage(const std::string& message) = 0;
67 virtual void InspectElement(int x, int y); 65 virtual void InspectElement(int x, int y);
68 66
69 void HostClosed(); 67 void HostClosed();
70 void SendMessageToClient(int session_id, const std::string& message); 68 void SendMessageToClient(int session_id, const std::string& message);
71 devtools::DevToolsIOContext* GetIOContext() { return &io_context_; } 69 devtools::DevToolsIOContext* GetIOContext() { return &io_context_; }
72 70
73 int session_id() { DCHECK(client_); return session_id_; } 71 int session_id() { DCHECK(client_); return session_id_; }
74 72
75 static void NotifyCallbacks(DevToolsAgentHostImpl* agent_host, bool attached); 73 static void NotifyCallbacks(DevToolsAgentHostImpl* agent_host, bool attached);
76 74
77 private: 75 private:
78 friend class DevToolsAgentHost; // for static methods 76 friend class DevToolsAgentHost; // for static methods
79 bool InnerAttach(DevToolsAgentHostClient* client, bool force); 77 bool InnerAttach(DevToolsAgentHostClient* client, bool force);
80 void InnerDetach(); 78 void InnerDetach();
81 79
82 const std::string id_; 80 const std::string id_;
83 int session_id_; 81 int session_id_;
84 std::string description_;
85 DevToolsAgentHostClient* client_; 82 DevToolsAgentHostClient* client_;
86 devtools::DevToolsIOContext io_context_; 83 devtools::DevToolsIOContext io_context_;
87 }; 84 };
88 85
89 class DevToolsMessageChunkProcessor { 86 class DevToolsMessageChunkProcessor {
90 public: 87 public:
91 using SendMessageCallback = base::Callback<void(int, const std::string&)>; 88 using SendMessageCallback = base::Callback<void(int, const std::string&)>;
92 explicit DevToolsMessageChunkProcessor(const SendMessageCallback& callback); 89 explicit DevToolsMessageChunkProcessor(const SendMessageCallback& callback);
93 ~DevToolsMessageChunkProcessor(); 90 ~DevToolsMessageChunkProcessor();
94 91
95 std::string state_cookie() const { return state_cookie_; } 92 std::string state_cookie() const { return state_cookie_; }
96 void set_state_cookie(const std::string& cookie) { state_cookie_ = cookie; } 93 void set_state_cookie(const std::string& cookie) { state_cookie_ = cookie; }
97 int last_call_id() const { return last_call_id_; } 94 int last_call_id() const { return last_call_id_; }
98 bool ProcessChunkedMessageFromAgent(const DevToolsMessageChunk& chunk); 95 bool ProcessChunkedMessageFromAgent(const DevToolsMessageChunk& chunk);
99 96
100 private: 97 private:
101 SendMessageCallback callback_; 98 SendMessageCallback callback_;
102 std::string message_buffer_; 99 std::string message_buffer_;
103 uint32_t message_buffer_size_; 100 uint32_t message_buffer_size_;
104 std::string state_cookie_; 101 std::string state_cookie_;
105 int last_call_id_; 102 int last_call_id_;
106 }; 103 };
107 104
108 } // namespace content 105 } // namespace content
109 106
110 #endif // CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_AGENT_HOST_IMPL_H_ 107 #endif // CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_AGENT_HOST_IMPL_H_
OLDNEW
« no previous file with comments | « content/browser/devtools/browser_devtools_agent_host.cc ('k') | content/browser/devtools/devtools_agent_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698