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