OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 CHROME_BROWSER_DEBUGGER_DEVTOOLS_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_DEBUGGER_DEVTOOLS_MANAGER_H_ |
6 #define CHROME_BROWSER_DEBUGGER_DEVTOOLS_MANAGER_H_ | 6 #define CHROME_BROWSER_DEBUGGER_DEVTOOLS_MANAGER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
| 9 #include <set> |
| 10 #include <string> |
9 | 11 |
10 #include "base/ref_counted.h" | 12 #include "base/ref_counted.h" |
11 #include "chrome/browser/debugger/devtools_client_host.h" | 13 #include "chrome/browser/debugger/devtools_client_host.h" |
12 | 14 |
13 namespace IPC { | 15 namespace IPC { |
14 class Message; | 16 class Message; |
15 } | 17 } |
16 | 18 |
17 class GURL; | 19 class GURL; |
18 class PrefService; | 20 class PrefService; |
(...skipping 28 matching lines...) Expand all Loading... |
47 void ForwardToDevToolsClient(RenderViewHost* inspected_rvh, | 49 void ForwardToDevToolsClient(RenderViewHost* inspected_rvh, |
48 const IPC::Message& message); | 50 const IPC::Message& message); |
49 | 51 |
50 void ActivateWindow(RenderViewHost* client_rvn); | 52 void ActivateWindow(RenderViewHost* client_rvn); |
51 void CloseWindow(RenderViewHost* client_rvn); | 53 void CloseWindow(RenderViewHost* client_rvn); |
52 void DockWindow(RenderViewHost* client_rvn); | 54 void DockWindow(RenderViewHost* client_rvn); |
53 void UndockWindow(RenderViewHost* client_rvn); | 55 void UndockWindow(RenderViewHost* client_rvn); |
54 void ToggleInspectElementMode(RenderViewHost* client_rvh, bool enabled); | 56 void ToggleInspectElementMode(RenderViewHost* client_rvh, bool enabled); |
55 | 57 |
56 void OpenDevToolsWindow(RenderViewHost* inspected_rvh); | 58 void OpenDevToolsWindow(RenderViewHost* inspected_rvh); |
57 | |
58 void ToggleDevToolsWindow(RenderViewHost* inspected_rvh); | 59 void ToggleDevToolsWindow(RenderViewHost* inspected_rvh); |
| 60 void RuntimeFeatureStateChanged(RenderViewHost* inspected_rvh, |
| 61 const std::string& feature, |
| 62 bool enabled); |
59 | 63 |
60 // Starts element inspection in the devtools client. | 64 // Starts element inspection in the devtools client. |
61 // Creates one by means of OpenDevToolsWindow if no client | 65 // Creates one by means of OpenDevToolsWindow if no client |
62 // exists. | 66 // exists. |
63 void InspectElement(RenderViewHost* inspected_rvh, int x, int y); | 67 void InspectElement(RenderViewHost* inspected_rvh, int x, int y); |
64 | 68 |
65 // Sends 'Attach' message to the agent using |dest_rvh| in case | 69 // Sends 'Attach' message to the agent using |dest_rvh| in case |
66 // there is a DevToolsClientHost registered for the |inspected_rvh|. | 70 // there is a DevToolsClientHost registered for the |inspected_rvh|. |
67 void OnNavigatingToPendingEntry(RenderViewHost* inspected_rvh, | 71 void OnNavigatingToPendingEntry(RenderViewHost* inspected_rvh, |
68 RenderViewHost* dest_rvh, | 72 RenderViewHost* dest_rvh, |
69 const GURL& gurl); | 73 const GURL& gurl); |
70 | 74 |
71 private: | 75 private: |
72 // DevToolsClientHost::CloseListener override. | 76 // DevToolsClientHost::CloseListener override. |
73 // This method will remove all references from the manager to the | 77 // This method will remove all references from the manager to the |
74 // DevToolsClientHost and unregister all listeners related to the | 78 // DevToolsClientHost and unregister all listeners related to the |
75 // DevToolsClientHost. | 79 // DevToolsClientHost. |
76 virtual void ClientHostClosing(DevToolsClientHost* host); | 80 virtual void ClientHostClosing(DevToolsClientHost* host); |
77 | 81 |
78 // Returns RenderViewHost for the tab that is inspected by devtools | 82 // Returns RenderViewHost for the tab that is inspected by devtools |
79 // client hosted by DevToolsClientHost. | 83 // client hosted by DevToolsClientHost. |
80 RenderViewHost* GetInspectedRenderViewHost(DevToolsClientHost* client_host); | 84 RenderViewHost* GetInspectedRenderViewHost(DevToolsClientHost* client_host); |
81 | 85 |
82 void SendAttachToAgent(RenderViewHost* inspected_rvh); | 86 void SendAttachToAgent(RenderViewHost* inspected_rvh, |
| 87 const std::set<std::string>& runtime_features); |
83 void SendDetachToAgent(RenderViewHost* inspected_rvh); | 88 void SendDetachToAgent(RenderViewHost* inspected_rvh); |
84 | 89 |
85 void ForceReopenWindow(); | 90 void ForceReopenWindow(); |
86 | 91 |
87 DevToolsClientHost* FindOnwerDevToolsClientHost(RenderViewHost* client_rvh); | 92 DevToolsClientHost* FindOnwerDevToolsClientHost(RenderViewHost* client_rvh); |
88 | 93 |
89 void ToggleDevToolsWindow(RenderViewHost* inspected_rvh, bool force_open); | 94 void ToggleDevToolsWindow(RenderViewHost* inspected_rvh, bool force_open); |
90 | 95 |
91 void ReopenWindow(RenderViewHost* client_rvh, bool docked); | 96 void ReopenWindow(RenderViewHost* client_rvh, bool docked); |
92 | 97 |
93 void CloseWindow(DevToolsClientHost* client_host); | 98 void CloseWindow(DevToolsClientHost* client_host); |
94 | 99 |
95 // These two maps are for tracking dependencies between inspected tabs and | 100 // These two maps are for tracking dependencies between inspected tabs and |
96 // their DevToolsClientHosts. They are usful for routing devtools messages | 101 // their DevToolsClientHosts. They are usful for routing devtools messages |
97 // and allow us to have at most one devtools client host per tab. We use | 102 // and allow us to have at most one devtools client host per tab. We use |
98 // NavigationController* as key because it survives crosee-site navigation in | 103 // NavigationController* as key because it survives crosee-site navigation in |
99 // cases when tab contents may change. | 104 // cases when tab contents may change. |
100 // | 105 // |
101 // DevToolsManager start listening to DevToolsClientHosts when they are put | 106 // DevToolsManager start listening to DevToolsClientHosts when they are put |
102 // into these maps and removes them when they are closing. | 107 // into these maps and removes them when they are closing. |
103 typedef std::map<RenderViewHost*, DevToolsClientHost*> | 108 typedef std::map<RenderViewHost*, DevToolsClientHost*> |
104 InspectedRvhToClientHostMap; | 109 InspectedRvhToClientHostMap; |
105 InspectedRvhToClientHostMap inspected_rvh_to_client_host_; | 110 InspectedRvhToClientHostMap inspected_rvh_to_client_host_; |
106 | 111 |
107 typedef std::map<DevToolsClientHost*, RenderViewHost*> | 112 typedef std::map<DevToolsClientHost*, RenderViewHost*> |
108 ClientHostToInspectedRvhMap; | 113 ClientHostToInspectedRvhMap; |
109 ClientHostToInspectedRvhMap client_host_to_inspected_rvh_; | 114 ClientHostToInspectedRvhMap client_host_to_inspected_rvh_; |
| 115 |
| 116 typedef std::map<RenderViewHost*, std::set<std::string> > |
| 117 RuntimeFeaturesMap; |
| 118 RuntimeFeaturesMap runtime_features_; |
| 119 |
110 RenderViewHost* inspected_rvh_for_reopen_; | 120 RenderViewHost* inspected_rvh_for_reopen_; |
111 bool in_initial_show_; | 121 bool in_initial_show_; |
112 | 122 |
113 DISALLOW_COPY_AND_ASSIGN(DevToolsManager); | 123 DISALLOW_COPY_AND_ASSIGN(DevToolsManager); |
114 }; | 124 }; |
115 | 125 |
116 #endif // CHROME_BROWSER_DEBUGGER_DEVTOOLS_MANAGER_H_ | 126 #endif // CHROME_BROWSER_DEBUGGER_DEVTOOLS_MANAGER_H_ |
OLD | NEW |