Chromium Code Reviews| 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); | |
|
Sami
2016/07/05 09:41:35
nit: NewPage etc.
alex clarke (OOO till 29th)
2016/07/05 11:54:00
Done.
| |
| 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 std::map<std::string, HeadlessWebContentsImpl*> web_contents_map_; | |
|
Sami
2016/07/05 09:41:35
Should we move this map to |browser_| (replacing t
alex clarke (OOO till 29th)
2016/07/05 11:54:00
Done.
| |
| 47 | |
| 48 using CommandMemberFnPtr = std::unique_ptr<base::Value> ( | |
| 49 HeadlessDevToolsManagerDelegate::*)(const base::DictionaryValue* params); | |
| 50 | |
| 51 std::map<std::string, CommandMemberFnPtr> command_map_; | |
| 52 }; | |
| 53 | |
| 54 } // namespace headless | |
| 55 | |
| 56 #endif // HEADLESS_LIB_BROWSER_HEADLESS_DEVTOOLS_MANAGER_DELEGATE_H_ | |
| OLD | NEW |