Chromium Code Reviews| Index: content/shell/browser/shell_devtools_bindings.h |
| diff --git a/content/shell/browser/shell_devtools_frontend.h b/content/shell/browser/shell_devtools_bindings.h |
| similarity index 68% |
| copy from content/shell/browser/shell_devtools_frontend.h |
| copy to content/shell/browser/shell_devtools_bindings.h |
| index cd4f3b5acba01ce471dbad780560b6bc9f36db56..1482669e49192be6860d5b8d3e8a28d5a256d1f9 100644 |
| --- a/content/shell/browser/shell_devtools_frontend.h |
| +++ b/content/shell/browser/shell_devtools_bindings.h |
| @@ -1,9 +1,9 @@ |
| -// Copyright 2013 The Chromium Authors. All rights reserved. |
| +// Copyright 2017 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 CONTENT_SHELL_BROWSER_SHELL_DEVTOOLS_FRONTEND_H_ |
| -#define CONTENT_SHELL_BROWSER_SHELL_DEVTOOLS_FRONTEND_H_ |
| +#ifndef CONTENT_SHELL_BROWSER_SHELL_DEVTOOLS_BINDINGS_H_ |
| +#define CONTENT_SHELL_BROWSER_SHELL_DEVTOOLS_BINDINGS_H_ |
| #include <memory> |
| @@ -23,39 +23,43 @@ class Value; |
| namespace content { |
| +class ShellDevToolsDelegate { |
| + public: |
| + virtual void Close() = 0; |
|
dgozman
2017/03/17 22:44:14
You also need empty virtual destructor.
chenwilliam
2017/03/20 21:32:20
:o - thanks!
|
| +}; |
| + |
| class RenderViewHost; |
| -class Shell; |
| class WebContents; |
| -class ShellDevToolsFrontend : public WebContentsObserver, |
| +class ShellDevToolsBindings : public WebContentsObserver, |
| public DevToolsAgentHostClient, |
| public net::URLFetcherDelegate { |
| public: |
| - static ShellDevToolsFrontend* Show(WebContents* inspected_contents); |
| + ShellDevToolsBindings(WebContents* devtools_contents, |
| + WebContents* inspected_contents, |
| + ShellDevToolsDelegate* delegate); |
| - void Activate(); |
| - void Focus(); |
| void InspectElementAt(int x, int y); |
| - void Close(); |
| void DisconnectFromTarget(); |
| - Shell* frontend_shell() const { return frontend_shell_; } |
| + WebContents* devtools_contents() const { return devtools_contents_; } |
| + WebContents* inspected_contents() const { return inspected_contents_; } |
| void CallClientFunction(const std::string& function_name, |
| const base::Value* arg1, |
| const base::Value* arg2, |
| const base::Value* arg3); |
| + void SetPreferences(const std::string& json); |
|
dgozman
2017/03/17 22:44:14
This should be protected.
chenwilliam
2017/03/20 21:32:20
Done.
|
| + void CreateFrontendHost(); |
| + ~ShellDevToolsBindings() override; |
| protected: |
| - ShellDevToolsFrontend(Shell* frontend_shell, WebContents* inspected_contents); |
| - ~ShellDevToolsFrontend() override; |
| - |
| // content::DevToolsAgentHostClient implementation. |
| void AgentHostClosed(DevToolsAgentHost* agent_host, bool replaced) override; |
| void DispatchProtocolMessage(DevToolsAgentHost* agent_host, |
| const std::string& message) override; |
| - void SetPreferences(const std::string& json); |
| + |
| virtual void HandleMessageFromDevToolsFrontend(const std::string& message); |
| private: |
| @@ -67,11 +71,11 @@ class ShellDevToolsFrontend : public WebContentsObserver, |
| // net::URLFetcherDelegate overrides. |
| void OnURLFetchComplete(const net::URLFetcher* source) override; |
| - void SendMessageAck(int request_id, |
| - const base::Value* arg1); |
| + void SendMessageAck(int request_id, const base::Value* arg1); |
| - Shell* frontend_shell_; |
| + WebContents* devtools_contents_; |
| WebContents* inspected_contents_; |
| + ShellDevToolsDelegate* delegate_; |
| scoped_refptr<DevToolsAgentHost> agent_host_; |
| int inspect_element_at_x_; |
| int inspect_element_at_y_; |
| @@ -79,11 +83,11 @@ class ShellDevToolsFrontend : public WebContentsObserver, |
| using PendingRequestsMap = std::map<const net::URLFetcher*, int>; |
| PendingRequestsMap pending_requests_; |
| base::DictionaryValue preferences_; |
| - base::WeakPtrFactory<ShellDevToolsFrontend> weak_factory_; |
| + base::WeakPtrFactory<ShellDevToolsBindings> weak_factory_; |
| - DISALLOW_COPY_AND_ASSIGN(ShellDevToolsFrontend); |
| + DISALLOW_COPY_AND_ASSIGN(ShellDevToolsBindings); |
| }; |
| } // namespace content |
| -#endif // CONTENT_SHELL_BROWSER_SHELL_DEVTOOLS_FRONTEND_H_ |
| +#endif // CONTENT_SHELL_BROWSER_SHELL_DEVTOOLS_BINDINGS_H_ |