Chromium Code Reviews| Index: headless/lib/browser/headless_devtools_manager_delegate.h |
| diff --git a/headless/lib/browser/headless_devtools_manager_delegate.h b/headless/lib/browser/headless_devtools_manager_delegate.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..edd4e1e7a7736906adb629693c5cd15054ec0398 |
| --- /dev/null |
| +++ b/headless/lib/browser/headless_devtools_manager_delegate.h |
| @@ -0,0 +1,56 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef HEADLESS_LIB_BROWSER_HEADLESS_DEVTOOLS_MANAGER_DELEGATE_H_ |
| +#define HEADLESS_LIB_BROWSER_HEADLESS_DEVTOOLS_MANAGER_DELEGATE_H_ |
| + |
| +#include "content/public/browser/devtools_manager_delegate.h" |
| + |
| +#include <map> |
| +#include <memory> |
| +#include <string> |
| + |
| +#include "base/values.h" |
| + |
| +namespace headless { |
| +class HeadlessBrowserImpl; |
| +class HeadlessBrowserContext; |
| +class HeadlessWebContentsImpl; |
| + |
| +class HeadlessDevToolsManagerDelegate |
| + : public content::DevToolsManagerDelegate { |
| + public: |
| + explicit HeadlessDevToolsManagerDelegate(HeadlessBrowserImpl* browser); |
| + ~HeadlessDevToolsManagerDelegate() override; |
| + |
| + // DevToolsManagerDelegate implementation: |
| + void Inspect(content::BrowserContext* browser_context, |
| + content::DevToolsAgentHost* agent_host) override {} |
| + void DevToolsAgentStateChanged(content::DevToolsAgentHost* agent_host, |
| + bool attached) override{}; |
| + base::DictionaryValue* HandleCommand(content::DevToolsAgentHost* agent_host, |
| + base::DictionaryValue* command) override; |
| + |
| + private: |
| + 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.
|
| + std::unique_ptr<base::Value> closePage(const base::DictionaryValue* params); |
| + std::unique_ptr<base::Value> newBrowserContext( |
| + const base::DictionaryValue* params); |
| + std::unique_ptr<base::Value> closeBrowserContext( |
| + const base::DictionaryValue* params); |
| + |
| + HeadlessBrowserImpl* browser_; // Not owned. |
| + std::map<std::string, std::unique_ptr<HeadlessBrowserContext>> |
| + browser_context_map_; |
| + 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.
|
| + |
| + using CommandMemberFnPtr = std::unique_ptr<base::Value> ( |
| + HeadlessDevToolsManagerDelegate::*)(const base::DictionaryValue* params); |
| + |
| + std::map<std::string, CommandMemberFnPtr> command_map_; |
| +}; |
| + |
| +} // namespace headless |
| + |
| +#endif // HEADLESS_LIB_BROWSER_HEADLESS_DEVTOOLS_MANAGER_DELEGATE_H_ |