OLD | NEW |
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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 std::string GetFrontendURL() override; | 42 std::string GetFrontendURL() override; |
43 base::TimeTicks GetLastActivityTime() override; | 43 base::TimeTicks GetLastActivityTime() override; |
44 BrowserContext* GetBrowserContext() override; | 44 BrowserContext* GetBrowserContext() override; |
45 WebContents* GetWebContents() override; | 45 WebContents* GetWebContents() override; |
46 void DisconnectWebContents() override; | 46 void DisconnectWebContents() override; |
47 void ConnectWebContents(WebContents* wc) override; | 47 void ConnectWebContents(WebContents* wc) override; |
48 | 48 |
49 bool Inspect(); | 49 bool Inspect(); |
50 void SendMessageToClient(int session_id, const std::string& message); | 50 void SendMessageToClient(int session_id, const std::string& message); |
51 | 51 |
| 52 template <typename HandlerT> |
| 53 HandlerT* GetHandler() const { |
| 54 return HandlerT::FromSession(session_.get()); |
| 55 } |
| 56 |
52 protected: | 57 protected: |
53 DevToolsAgentHostImpl(const std::string& id); | 58 DevToolsAgentHostImpl(const std::string& id); |
54 ~DevToolsAgentHostImpl() override; | 59 ~DevToolsAgentHostImpl() override; |
55 | 60 |
56 static bool ShouldForceCreation(); | 61 static bool ShouldForceCreation(); |
57 | 62 |
58 virtual void AttachSession(DevToolsSession* session) = 0; | 63 virtual void AttachSession(DevToolsSession* session) = 0; |
59 virtual void DetachSession(int session_id) = 0; | 64 virtual void DetachSession(int session_id) = 0; |
60 virtual bool DispatchProtocolMessage( | 65 virtual bool DispatchProtocolMessage( |
61 DevToolsSession* session, | 66 DevToolsSession* session, |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 SendMessageCallback callback_; | 106 SendMessageCallback callback_; |
102 std::string message_buffer_; | 107 std::string message_buffer_; |
103 uint32_t message_buffer_size_; | 108 uint32_t message_buffer_size_; |
104 std::string state_cookie_; | 109 std::string state_cookie_; |
105 int last_call_id_; | 110 int last_call_id_; |
106 }; | 111 }; |
107 | 112 |
108 } // namespace content | 113 } // namespace content |
109 | 114 |
110 #endif // CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_AGENT_HOST_IMPL_H_ | 115 #endif // CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_AGENT_HOST_IMPL_H_ |
OLD | NEW |