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

Side by Side Diff: content/shell/browser/shell_devtools_frontend.h

Issue 2756623002: DevTools: extract bindings from ShellDevToolsFrontend (Closed)
Patch Set: fixup Created 3 years, 9 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
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 CONTENT_SHELL_BROWSER_SHELL_DEVTOOLS_FRONTEND_H_ 5 #ifndef CONTENT_SHELL_BROWSER_SHELL_DEVTOOLS_FRONTEND_H_
6 #define CONTENT_SHELL_BROWSER_SHELL_DEVTOOLS_FRONTEND_H_ 6 #define CONTENT_SHELL_BROWSER_SHELL_DEVTOOLS_FRONTEND_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/ref_counted.h"
13 #include "base/memory/weak_ptr.h"
14 #include "base/values.h"
15 #include "content/public/browser/devtools_agent_host.h"
16 #include "content/public/browser/web_contents_observer.h" 12 #include "content/public/browser/web_contents_observer.h"
17 #include "net/url_request/url_fetcher_delegate.h" 13 #include "content/shell/browser/shell_devtools_bindings.h"
18
19 #if !defined(OS_ANDROID)
20 #include "content/public/browser/devtools_frontend_host.h"
21 #endif
22
23 namespace base {
24 class Value;
25 }
26 14
27 namespace content { 15 namespace content {
28 16
29 class RenderViewHost;
30 class Shell; 17 class Shell;
31 class WebContents; 18 class WebContents;
32 19
33 class ShellDevToolsFrontend : public WebContentsObserver, 20 class ShellDevToolsFrontend : public ShellDevToolsDelegate,
34 public DevToolsAgentHostClient, 21 public WebContentsObserver {
35 public net::URLFetcherDelegate {
36 public: 22 public:
37 static ShellDevToolsFrontend* Show(WebContents* inspected_contents); 23 static ShellDevToolsFrontend* Show(WebContents* inspected_contents);
38 24
39 void Activate(); 25 void Activate();
40 void Focus(); 26 void Focus();
41 void InspectElementAt(int x, int y); 27 void InspectElementAt(int x, int y);
42 void Close(); 28 void Close() override;
43
44 void DisconnectFromTarget();
45 29
46 Shell* frontend_shell() const { return frontend_shell_; } 30 Shell* frontend_shell() const { return frontend_shell_; }
47 31
48 void CallClientFunction(const std::string& function_name, 32 private:
49 const base::Value* arg1, 33 // WebContentsObserver overrides
50 const base::Value* arg2, 34 void WebContentsDestroyed() override;
51 const base::Value* arg3);
52 35
53 protected:
54 ShellDevToolsFrontend(Shell* frontend_shell, WebContents* inspected_contents); 36 ShellDevToolsFrontend(Shell* frontend_shell, WebContents* inspected_contents);
55 ~ShellDevToolsFrontend() override; 37 ~ShellDevToolsFrontend() override;
56
57 // content::DevToolsAgentHostClient implementation.
58 void AgentHostClosed(DevToolsAgentHost* agent_host, bool replaced) override;
59 void DispatchProtocolMessage(DevToolsAgentHost* agent_host,
60 const std::string& message) override;
61 void SetPreferences(const std::string& json);
62 virtual void HandleMessageFromDevToolsFrontend(const std::string& message);
63
64 private:
65 // WebContentsObserver overrides
66 void RenderViewCreated(RenderViewHost* render_view_host) override;
67 void DocumentAvailableInMainFrame() override;
68 void WebContentsDestroyed() override;
69
70 // net::URLFetcherDelegate overrides.
71 void OnURLFetchComplete(const net::URLFetcher* source) override;
72
73 void SendMessageAck(int request_id,
74 const base::Value* arg1);
75
76 Shell* frontend_shell_; 38 Shell* frontend_shell_;
77 WebContents* inspected_contents_; 39 std::unique_ptr<ShellDevToolsBindings> devtools_bindings_;
78 scoped_refptr<DevToolsAgentHost> agent_host_;
79 int inspect_element_at_x_;
80 int inspect_element_at_y_;
81 #if !defined(OS_ANDROID)
82 std::unique_ptr<DevToolsFrontendHost> frontend_host_;
83 #endif
84 using PendingRequestsMap = std::map<const net::URLFetcher*, int>;
85 PendingRequestsMap pending_requests_;
86 base::DictionaryValue preferences_;
87 base::WeakPtrFactory<ShellDevToolsFrontend> weak_factory_;
88 40
89 DISALLOW_COPY_AND_ASSIGN(ShellDevToolsFrontend); 41 DISALLOW_COPY_AND_ASSIGN(ShellDevToolsFrontend);
90 }; 42 };
91 43
92 } // namespace content 44 } // namespace content
93 45
94 #endif // CONTENT_SHELL_BROWSER_SHELL_DEVTOOLS_FRONTEND_H_ 46 #endif // CONTENT_SHELL_BROWSER_SHELL_DEVTOOLS_FRONTEND_H_
OLDNEW
« no previous file with comments | « content/shell/browser/shell_devtools_bindings.cc ('k') | content/shell/browser/shell_devtools_frontend.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698