Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(351)

Side by Side Diff: headless/lib/browser/headless_devtools_manager_delegate.h

Issue 2119063002: Add commands to manage tabs and contexts to Browser Domain (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added a check to prevent Browser.closeContext from closing a context that is in use. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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> newContext(const base::DictionaryValue* params);
39 std::unique_ptr<base::Value> closeContext(
40 const base::DictionaryValue* params);
41
42 HeadlessBrowserImpl* browser_; // Not owned.
43 std::map<std::string, std::unique_ptr<HeadlessBrowserContext>>
44 browser_context_map_;
45 std::map<std::string, HeadlessWebContentsImpl*> web_contents_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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698