| OLD | NEW |
| 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_MANAGER_H_ | 5 #ifndef CONTENT_BROWSER_DEBUGGER_DEVTOOLS_MANAGER_H_ |
| 6 #define CONTENT_BROWSER_DEBUGGER_DEVTOOLS_MANAGER_H_ | 6 #define CONTENT_BROWSER_DEBUGGER_DEVTOOLS_MANAGER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 // Returns DevToolsClientHost registered for |inspected_rvh| or NULL if | 46 // Returns DevToolsClientHost registered for |inspected_rvh| or NULL if |
| 47 // there is no alive DevToolsClientHost registered for |inspected_rvh|. | 47 // there is no alive DevToolsClientHost registered for |inspected_rvh|. |
| 48 DevToolsClientHost* GetDevToolsClientHostFor(RenderViewHost* inspected_rvh); | 48 DevToolsClientHost* GetDevToolsClientHostFor(RenderViewHost* inspected_rvh); |
| 49 | 49 |
| 50 // Registers new DevToolsClientHost for |inspected_rvh|. There must be no | 50 // Registers new DevToolsClientHost for |inspected_rvh|. There must be no |
| 51 // other DevToolsClientHosts registered for the RenderViewHost at the moment. | 51 // other DevToolsClientHosts registered for the RenderViewHost at the moment. |
| 52 void RegisterDevToolsClientHostFor(RenderViewHost* inspected_rvh, | 52 void RegisterDevToolsClientHostFor(RenderViewHost* inspected_rvh, |
| 53 DevToolsClientHost* client_host); | 53 DevToolsClientHost* client_host); |
| 54 void UnregisterDevToolsClientHostFor(RenderViewHost* inspected_rvh); | 54 void UnregisterDevToolsClientHostFor(RenderViewHost* inspected_rvh); |
| 55 | 55 |
| 56 void ForwardToDevToolsAgent(RenderViewHost* client_rvh, | |
| 57 const IPC::Message& message); | |
| 58 void ForwardToDevToolsAgent(DevToolsClientHost* from, | 56 void ForwardToDevToolsAgent(DevToolsClientHost* from, |
| 59 const IPC::Message& message); | 57 const IPC::Message& message); |
| 60 void ForwardToDevToolsClient(RenderViewHost* inspected_rvh, | 58 void ForwardToDevToolsClient(RenderViewHost* inspected_rvh, |
| 61 const IPC::Message& message); | 59 const IPC::Message& message); |
| 62 | 60 |
| 63 void ActivateWindow(RenderViewHost* client_rvn); | |
| 64 void CloseWindow(RenderViewHost* client_rvn); | |
| 65 void RequestDockWindow(RenderViewHost* client_rvn); | |
| 66 void RequestUndockWindow(RenderViewHost* client_rvn); | |
| 67 | |
| 68 void OpenDevToolsWindow(RenderViewHost* inspected_rvh); | |
| 69 void ToggleDevToolsWindow(RenderViewHost* inspected_rvh, | |
| 70 DevToolsToggleAction action); | |
| 71 void RuntimePropertyChanged(RenderViewHost* inspected_rvh, | 61 void RuntimePropertyChanged(RenderViewHost* inspected_rvh, |
| 72 const std::string& name, | 62 const std::string& name, |
| 73 const std::string& value); | 63 const std::string& value); |
| 74 | 64 |
| 75 // Starts element inspection in the devtools client. | 65 // Starts element inspection in the devtools agent. |
| 76 // Creates one by means of OpenDevToolsWindow if no client | 66 void SendInspectElement(RenderViewHost* inspected_rvh, int x, int y); |
| 77 // exists. | |
| 78 void InspectElement(RenderViewHost* inspected_rvh, int x, int y); | |
| 79 | 67 |
| 80 // Sends 'Attach' message to the agent using |dest_rvh| in case | 68 // Sends 'Attach' message to the agent using |dest_rvh| in case |
| 81 // there is a DevToolsClientHost registered for the |inspected_rvh|. | 69 // there is a DevToolsClientHost registered for the |inspected_rvh|. |
| 82 void OnNavigatingToPendingEntry(RenderViewHost* inspected_rvh, | 70 void OnNavigatingToPendingEntry(RenderViewHost* inspected_rvh, |
| 83 RenderViewHost* dest_rvh, | 71 RenderViewHost* dest_rvh, |
| 84 const GURL& gurl); | 72 const GURL& gurl); |
| 85 | 73 |
| 86 // Invoked when a tab is replaced by another tab. This is triggered by | 74 // Invoked when a tab is replaced by another tab. This is triggered by |
| 87 // TabStripModel::ReplaceTabContentsAt. | 75 // TabStripModel::ReplaceTabContentsAt. |
| 88 void TabReplaced(TabContentsWrapper* old_tab, TabContentsWrapper* new_tab); | 76 void TabReplaced(TabContentsWrapper* old_tab, TabContentsWrapper* new_tab); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 114 const NotificationSource& source, | 102 const NotificationSource& source, |
| 115 const NotificationDetails& details); | 103 const NotificationDetails& details); |
| 116 | 104 |
| 117 // Returns RenderViewHost for the tab that is inspected by devtools | 105 // Returns RenderViewHost for the tab that is inspected by devtools |
| 118 // client hosted by DevToolsClientHost. | 106 // client hosted by DevToolsClientHost. |
| 119 RenderViewHost* GetInspectedRenderViewHost(DevToolsClientHost* client_host); | 107 RenderViewHost* GetInspectedRenderViewHost(DevToolsClientHost* client_host); |
| 120 | 108 |
| 121 void SendAttachToAgent(RenderViewHost* inspected_rvh); | 109 void SendAttachToAgent(RenderViewHost* inspected_rvh); |
| 122 void SendDetachToAgent(RenderViewHost* inspected_rvh); | 110 void SendDetachToAgent(RenderViewHost* inspected_rvh); |
| 123 | 111 |
| 124 void ForceReopenWindow(); | |
| 125 | |
| 126 DevToolsClientHost* FindOwnerDevToolsClientHost(RenderViewHost* client_rvh); | |
| 127 | |
| 128 void ToggleDevToolsWindow(RenderViewHost* inspected_rvh, | |
| 129 bool force_open, | |
| 130 DevToolsToggleAction action); | |
| 131 | |
| 132 void ReopenWindow(RenderViewHost* client_rvh, bool docked); | |
| 133 | |
| 134 void BindClientHost(RenderViewHost* inspected_rvh, | 112 void BindClientHost(RenderViewHost* inspected_rvh, |
| 135 DevToolsClientHost* client_host, | 113 DevToolsClientHost* client_host, |
| 136 const DevToolsRuntimeProperties& runtime_properties); | 114 const DevToolsRuntimeProperties& runtime_properties); |
| 137 | 115 |
| 138 void UnbindClientHost(RenderViewHost* inspected_rvh, | 116 void UnbindClientHost(RenderViewHost* inspected_rvh, |
| 139 DevToolsClientHost* client_host); | 117 DevToolsClientHost* client_host); |
| 140 | 118 |
| 141 // These two maps are for tracking dependencies between inspected tabs and | 119 // These two maps are for tracking dependencies between inspected tabs and |
| 142 // their DevToolsClientHosts. They are useful for routing devtools messages | 120 // their DevToolsClientHosts. They are useful for routing devtools messages |
| 143 // and allow us to have at most one devtools client host per tab. | 121 // and allow us to have at most one devtools client host per tab. |
| 144 // | 122 // |
| 145 // DevToolsManager start listening to DevToolsClientHosts when they are put | 123 // DevToolsManager start listening to DevToolsClientHosts when they are put |
| 146 // into these maps and removes them when they are closing. | 124 // into these maps and removes them when they are closing. |
| 147 typedef std::map<RenderViewHost*, DevToolsClientHost*> | 125 typedef std::map<RenderViewHost*, DevToolsClientHost*> |
| 148 InspectedRvhToClientHostMap; | 126 InspectedRvhToClientHostMap; |
| 149 InspectedRvhToClientHostMap inspected_rvh_to_client_host_; | 127 InspectedRvhToClientHostMap inspected_rvh_to_client_host_; |
| 150 | 128 |
| 151 typedef std::map<DevToolsClientHost*, RenderViewHost*> | 129 typedef std::map<DevToolsClientHost*, RenderViewHost*> |
| 152 ClientHostToInspectedRvhMap; | 130 ClientHostToInspectedRvhMap; |
| 153 ClientHostToInspectedRvhMap client_host_to_inspected_rvh_; | 131 ClientHostToInspectedRvhMap client_host_to_inspected_rvh_; |
| 154 | 132 |
| 155 typedef std::map<RenderViewHost*, DevToolsRuntimeProperties> | 133 typedef std::map<RenderViewHost*, DevToolsRuntimeProperties> |
| 156 RuntimePropertiesMap; | 134 RuntimePropertiesMap; |
| 157 RuntimePropertiesMap runtime_properties_map_; | 135 RuntimePropertiesMap runtime_properties_map_; |
| 158 | 136 |
| 159 RenderViewHost* inspected_rvh_for_reopen_; | |
| 160 bool in_initial_show_; | |
| 161 | |
| 162 typedef std::map<int, | 137 typedef std::map<int, |
| 163 std::pair<DevToolsClientHost*, DevToolsRuntimeProperties> > | 138 std::pair<DevToolsClientHost*, DevToolsRuntimeProperties> > |
| 164 OrphanClientHosts; | 139 OrphanClientHosts; |
| 165 OrphanClientHosts orphan_client_hosts_; | 140 OrphanClientHosts orphan_client_hosts_; |
| 166 int last_orphan_cookie_; | 141 int last_orphan_cookie_; |
| 167 | 142 |
| 168 NotificationRegistrar registrar_; | 143 NotificationRegistrar registrar_; |
| 169 | 144 |
| 170 DISALLOW_COPY_AND_ASSIGN(DevToolsManager); | 145 DISALLOW_COPY_AND_ASSIGN(DevToolsManager); |
| 171 }; | 146 }; |
| 172 | 147 |
| 173 #endif // CONTENT_BROWSER_DEBUGGER_DEVTOOLS_MANAGER_H_ | 148 #endif // CONTENT_BROWSER_DEBUGGER_DEVTOOLS_MANAGER_H_ |
| OLD | NEW |