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

Side by Side Diff: content/public/browser/devtools_client_host.h

Issue 8549022: Define DevTools content API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed pfeldman's comments Created 9 years 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_BROWSER_DEBUGGER_DEVTOOLS_CLIENT_HOST_H_ 5 #ifndef CONTENT_PUBLIC_BROWSER_DEVTOOLS_CLIENT_HOST_H_
6 #define CONTENT_BROWSER_DEBUGGER_DEVTOOLS_CLIENT_HOST_H_ 6 #define CONTENT_PUBLIC_BROWSER_DEVTOOLS_CLIENT_HOST_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "content/common/content_export.h" 12 #include "content/common/content_export.h"
13 13
14 namespace IPC { 14 namespace IPC {
15 class Message; 15 class Message;
16 } 16 }
17 17
18 class RenderViewHost;
18 class TabContents; 19 class TabContents;
19 20
21 namespace content {
22
23 class DevToolsFrontendHostDelegate;
24
20 // Describes interface for managing devtools clients from browser process. There 25 // Describes interface for managing devtools clients from browser process. There
21 // are currently two types of clients: devtools windows and TCP socket 26 // are currently two types of clients: devtools windows and TCP socket
22 // debuggers. 27 // debuggers.
23 class CONTENT_EXPORT DevToolsClientHost { 28 class CONTENT_EXPORT DevToolsClientHost {
24 public: 29 public:
25 class CONTENT_EXPORT CloseListener { 30 DevToolsClientHost();
jam 2011/12/01 03:51:47 nit: we avoid constructors on interfaces
yurys 2011/12/01 15:20:06 Done.
26 public: 31 virtual ~DevToolsClientHost();
jam 2011/12/01 03:51:47 nit: convention for the content API is to inline t
yurys 2011/12/01 15:20:06 Done.
27 CloseListener() {}
28 virtual ~CloseListener() {}
29 virtual void ClientHostClosing(DevToolsClientHost* host) = 0;
30 private:
31 DISALLOW_COPY_AND_ASSIGN(CloseListener);
32 };
33 32
34 virtual ~DevToolsClientHost(); 33 // Dispatches given message on the front-end.
34 virtual void DispatchOnInspectorFrontend(const std::string& message) = 0;
35 35
36 // This method is called when tab inspected by this devtools client is 36 // This method is called when tab inspected by this devtools client is
37 // closing. 37 // closing.
38 virtual void InspectedTabClosing() = 0; 38 virtual void InspectedTabClosing() = 0;
39 39
40 // This method is called when tab inspected by this devtools client is 40 // This method is called when tab inspected by this devtools client is
41 // navigating to |url|. 41 // navigating to |url|.
42 virtual void FrameNavigating(const std::string& url) = 0; 42 virtual void FrameNavigating(const std::string& url) = 0;
43 43
44 // Sends the message to the devtools client hosted by this object.
45 virtual void SendMessageToClient(const IPC::Message& msg) = 0;
46
47 void set_close_listener(CloseListener* listener) {
48 close_listener_ = listener;
49 }
50
51 // Invoked when a tab is replaced by another tab. This is triggered by 44 // Invoked when a tab is replaced by another tab. This is triggered by
52 // TabStripModel::ReplaceTabContentsAt. 45 // TabStripModel::ReplaceTabContentsAt.
53 virtual void TabReplaced(TabContents* new_tab) = 0; 46 virtual void TabReplaced(TabContents* new_tab) = 0;
54 47
55 protected: 48 // Creates DevToolsClientHost for TabContents containing default DevTools
56 DevToolsClientHost(); 49 // frontend implementation.
50 static DevToolsClientHost* CreateDevToolsFrontendHost(
51 TabContents* client_tab_contents,
52 DevToolsFrontendHostDelegate* delegate);
57 53
58 void ForwardToDevToolsAgent(const IPC::Message& message); 54 // Sets up DevToolsClient on the corresponding RenderView.
59 55 static void SetupDevToolsFrontendClient(RenderViewHost* frontend_rvh);
60 // Should be called when the devtools client is going to die and this
61 // DevToolsClientHost should not be used anymore.
62 void NotifyCloseListener();
63
64 private:
65 CloseListener* close_listener_;
66 DISALLOW_COPY_AND_ASSIGN(DevToolsClientHost);
67 }; 56 };
68 57
69 #endif // CONTENT_BROWSER_DEBUGGER_DEVTOOLS_CLIENT_HOST_H_ 58 } // namespace content
59
60 #endif // CONTENT_PUBLIC_BROWSER_DEVTOOLS_CLIENT_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698