| 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 HEADLESS_LIB_BROWSER_HEADLESS_DEVTOOLS_MANAGER_DELEGATE_H_ | 5 #ifndef HEADLESS_LIB_BROWSER_HEADLESS_DEVTOOLS_MANAGER_DELEGATE_H_ |
| 6 #define HEADLESS_LIB_BROWSER_HEADLESS_DEVTOOLS_MANAGER_DELEGATE_H_ | 6 #define HEADLESS_LIB_BROWSER_HEADLESS_DEVTOOLS_MANAGER_DELEGATE_H_ |
| 7 | 7 |
| 8 #include "content/public/browser/devtools_manager_delegate.h" | 8 #include "content/public/browser/devtools_manager_delegate.h" |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| 11 #include <memory> | 11 #include <memory> |
| 12 #include <string> | 12 #include <string> |
| 13 | 13 |
| 14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 15 #include "base/values.h" | 15 #include "base/values.h" |
| 16 | 16 |
| 17 namespace headless { | 17 namespace headless { |
| 18 class HeadlessBrowserImpl; | 18 class HeadlessBrowserImpl; |
| 19 class HeadlessBrowserContext; | 19 class HeadlessBrowserContext; |
| 20 class HeadlessWebContentsImpl; | 20 class HeadlessWebContentsImpl; |
| 21 | 21 |
| 22 class HeadlessDevToolsManagerDelegate | 22 class HeadlessDevToolsManagerDelegate |
| 23 : public content::DevToolsManagerDelegate { | 23 : public content::DevToolsManagerDelegate { |
| 24 public: | 24 public: |
| 25 explicit HeadlessDevToolsManagerDelegate( | 25 explicit HeadlessDevToolsManagerDelegate( |
| 26 base::WeakPtr<HeadlessBrowserImpl> browser); | 26 base::WeakPtr<HeadlessBrowserImpl> browser); |
| 27 ~HeadlessDevToolsManagerDelegate() override; | 27 ~HeadlessDevToolsManagerDelegate() override; |
| 28 | 28 |
| 29 // DevToolsManagerDelegate implementation: | 29 // DevToolsManagerDelegate implementation: |
| 30 void Inspect(content::DevToolsAgentHost* agent_host) override {} | 30 void Inspect(content::BrowserContext* browser_context, |
| 31 content::DevToolsAgentHost* agent_host) override {} |
| 31 void DevToolsAgentStateChanged(content::DevToolsAgentHost* agent_host, | 32 void DevToolsAgentStateChanged(content::DevToolsAgentHost* agent_host, |
| 32 bool attached) override{}; | 33 bool attached) override{}; |
| 33 base::DictionaryValue* HandleCommand(content::DevToolsAgentHost* agent_host, | 34 base::DictionaryValue* HandleCommand(content::DevToolsAgentHost* agent_host, |
| 34 base::DictionaryValue* command) override; | 35 base::DictionaryValue* command) override; |
| 35 std::string GetTargetType(content::RenderFrameHost* host) override; | |
| 36 std::string GetTargetTitle(content::RenderFrameHost* host) override; | |
| 37 | 36 |
| 38 private: | 37 private: |
| 39 std::unique_ptr<base::Value> CreateTarget( | 38 std::unique_ptr<base::Value> CreateTarget( |
| 40 const base::DictionaryValue* params); | 39 const base::DictionaryValue* params); |
| 41 std::unique_ptr<base::Value> CloseTarget(const base::DictionaryValue* params); | 40 std::unique_ptr<base::Value> CloseTarget(const base::DictionaryValue* params); |
| 42 std::unique_ptr<base::Value> CreateBrowserContext( | 41 std::unique_ptr<base::Value> CreateBrowserContext( |
| 43 const base::DictionaryValue* params); | 42 const base::DictionaryValue* params); |
| 44 std::unique_ptr<base::Value> DisposeBrowserContext( | 43 std::unique_ptr<base::Value> DisposeBrowserContext( |
| 45 const base::DictionaryValue* params); | 44 const base::DictionaryValue* params); |
| 46 | 45 |
| 47 base::WeakPtr<HeadlessBrowserImpl> browser_; | 46 base::WeakPtr<HeadlessBrowserImpl> browser_; |
| 48 | 47 |
| 49 using CommandMemberFnPtr = std::unique_ptr<base::Value> ( | 48 using CommandMemberFnPtr = std::unique_ptr<base::Value> ( |
| 50 HeadlessDevToolsManagerDelegate::*)(const base::DictionaryValue* params); | 49 HeadlessDevToolsManagerDelegate::*)(const base::DictionaryValue* params); |
| 51 | 50 |
| 52 std::map<std::string, CommandMemberFnPtr> command_map_; | 51 std::map<std::string, CommandMemberFnPtr> command_map_; |
| 53 | 52 |
| 54 HeadlessBrowserContext* default_browser_context_; | 53 HeadlessBrowserContext* default_browser_context_; |
| 55 }; | 54 }; |
| 56 | 55 |
| 57 } // namespace headless | 56 } // namespace headless |
| 58 | 57 |
| 59 #endif // HEADLESS_LIB_BROWSER_HEADLESS_DEVTOOLS_MANAGER_DELEGATE_H_ | 58 #endif // HEADLESS_LIB_BROWSER_HEADLESS_DEVTOOLS_MANAGER_DELEGATE_H_ |
| OLD | NEW |