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 #include "content/browser/debugger/devtools_manager.h" | 5 #include "content/browser/debugger/devtools_manager.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 | 34 |
35 // static | 35 // static |
36 void DevToolsManager::RegisterUserPrefs(PrefService* prefs) { | 36 void DevToolsManager::RegisterUserPrefs(PrefService* prefs) { |
37 prefs->RegisterBooleanPref(prefs::kDevToolsOpenDocked, | 37 prefs->RegisterBooleanPref(prefs::kDevToolsOpenDocked, |
38 true, | 38 true, |
39 PrefService::UNSYNCABLE_PREF); | 39 PrefService::UNSYNCABLE_PREF); |
40 } | 40 } |
41 | 41 |
42 DevToolsManager::DevToolsManager() | 42 DevToolsManager::DevToolsManager() |
43 : last_orphan_cookie_(0) { | 43 : last_orphan_cookie_(0) { |
44 registrar_.Add(this, NotificationType::RENDER_VIEW_HOST_DELETED, | 44 registrar_.Add(this, content::NOTIFICATION_RENDER_VIEW_HOST_DELETED, |
45 NotificationService::AllSources()); | 45 NotificationService::AllSources()); |
46 } | 46 } |
47 | 47 |
48 DevToolsManager::~DevToolsManager() { | 48 DevToolsManager::~DevToolsManager() { |
49 DCHECK(inspected_rvh_to_client_host_.empty()); | 49 DCHECK(inspected_rvh_to_client_host_.empty()); |
50 DCHECK(client_host_to_inspected_rvh_.empty()); | 50 DCHECK(client_host_to_inspected_rvh_.empty()); |
51 // By the time we destroy devtools manager, all orphan client hosts should | 51 // By the time we destroy devtools manager, all orphan client hosts should |
52 // have been delelted, no need to notify them upon tab closing. | 52 // have been delelted, no need to notify them upon tab closing. |
53 DCHECK(orphan_client_hosts_.empty()); | 53 DCHECK(orphan_client_hosts_.empty()); |
54 } | 54 } |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 it != orphan_client_hosts_.end(); ++it) { | 128 it != orphan_client_hosts_.end(); ++it) { |
129 if (it->second.first == host) { | 129 if (it->second.first == host) { |
130 orphan_client_hosts_.erase(it->first); | 130 orphan_client_hosts_.erase(it->first); |
131 return; | 131 return; |
132 } | 132 } |
133 } | 133 } |
134 return; | 134 return; |
135 } | 135 } |
136 | 136 |
137 NotificationService::current()->Notify( | 137 NotificationService::current()->Notify( |
138 NotificationType::DEVTOOLS_WINDOW_CLOSING, | 138 content::NOTIFICATION_DEVTOOLS_WINDOW_CLOSING, |
139 Source<Profile>(inspected_rvh->site_instance()->GetProcess()->profile()), | 139 Source<Profile>(inspected_rvh->site_instance()->GetProcess()->profile()), |
140 Details<RenderViewHost>(inspected_rvh)); | 140 Details<RenderViewHost>(inspected_rvh)); |
141 | 141 |
142 UnbindClientHost(inspected_rvh, host); | 142 UnbindClientHost(inspected_rvh, host); |
143 } | 143 } |
144 | 144 |
145 void DevToolsManager::Observe(NotificationType type, | 145 void DevToolsManager::Observe(int type, |
146 const NotificationSource& source, | 146 const NotificationSource& source, |
147 const NotificationDetails& details) { | 147 const NotificationDetails& details) { |
148 DCHECK(type == NotificationType::RENDER_VIEW_HOST_DELETED); | 148 DCHECK(type == content::NOTIFICATION_RENDER_VIEW_HOST_DELETED); |
149 UnregisterDevToolsClientHostFor(Source<RenderViewHost>(source).ptr()); | 149 UnregisterDevToolsClientHostFor(Source<RenderViewHost>(source).ptr()); |
150 } | 150 } |
151 | 151 |
152 RenderViewHost* DevToolsManager::GetInspectedRenderViewHost( | 152 RenderViewHost* DevToolsManager::GetInspectedRenderViewHost( |
153 DevToolsClientHost* client_host) { | 153 DevToolsClientHost* client_host) { |
154 ClientHostToInspectedRvhMap::iterator it = | 154 ClientHostToInspectedRvhMap::iterator it = |
155 client_host_to_inspected_rvh_.find(client_host); | 155 client_host_to_inspected_rvh_.find(client_host); |
156 if (it != client_host_to_inspected_rvh_.end()) | 156 if (it != client_host_to_inspected_rvh_.end()) |
157 return it->second; | 157 return it->second; |
158 return NULL; | 158 return NULL; |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 for (InspectedRvhToClientHostMap::iterator it = | 305 for (InspectedRvhToClientHostMap::iterator it = |
306 inspected_rvh_to_client_host_.begin(); | 306 inspected_rvh_to_client_host_.begin(); |
307 it != inspected_rvh_to_client_host_.end(); ++it) { | 307 it != inspected_rvh_to_client_host_.end(); ++it) { |
308 rhvs.push_back(it->first); | 308 rhvs.push_back(it->first); |
309 } | 309 } |
310 for (std::vector<RenderViewHost*>::iterator it = rhvs.begin(); | 310 for (std::vector<RenderViewHost*>::iterator it = rhvs.begin(); |
311 it != rhvs.end(); ++it) { | 311 it != rhvs.end(); ++it) { |
312 UnregisterDevToolsClientHostFor(*it); | 312 UnregisterDevToolsClientHostFor(*it); |
313 } | 313 } |
314 } | 314 } |
OLD | NEW |