OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/browser/task_manager/guest_resource_provider.h" | 5 #include "chrome/browser/task_manager/guest_resource_provider.h" |
6 | 6 |
7 #include "base/string16.h" | 7 #include "base/string16.h" |
8 #include "chrome/browser/favicon/favicon_tab_helper.h" | 8 #include "chrome/browser/favicon/favicon_tab_helper.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/task_manager/renderer_resource.h" | 10 #include "chrome/browser/task_manager/renderer_resource.h" |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
125 } | 125 } |
126 | 126 |
127 return NULL; | 127 return NULL; |
128 } | 128 } |
129 | 129 |
130 void GuestResourceProvider::StartUpdating() { | 130 void GuestResourceProvider::StartUpdating() { |
131 DCHECK(!updating_); | 131 DCHECK(!updating_); |
132 updating_ = true; | 132 updating_ = true; |
133 | 133 |
134 // Add all the existing guest WebContents. | 134 // Add all the existing guest WebContents. |
135 for (RenderProcessHost::iterator i( | 135 RenderWidgetHost::List widgets = RenderWidgetHost::GetRenderWidgetHosts(); |
136 RenderProcessHost::AllHostsIterator()); | 136 for (RenderWidgetHost::List::const_iterator it = widgets.begin(); |
jam
2013/06/12 19:59:59
ditto
nasko
2013/06/12 21:18:59
Done.
| |
137 !i.IsAtEnd(); i.Advance()) { | 137 it != widgets.end(); ++it) { |
138 RenderProcessHost::RenderWidgetHostsIterator iter = | 138 const RenderWidgetHost* widget = *it; |
139 i.GetCurrentValue()->GetRenderWidgetHostsIterator(); | 139 if (widget->IsRenderView()) { |
140 for (; !iter.IsAtEnd(); iter.Advance()) { | 140 RenderViewHost* rvh = |
141 const RenderWidgetHost* widget = iter.GetCurrentValue(); | 141 RenderViewHost::From(const_cast<RenderWidgetHost*>(widget)); |
142 if (widget->IsRenderView()) { | 142 if (rvh->IsSubframe()) |
143 RenderViewHost* rvh = | 143 Add(rvh); |
144 RenderViewHost::From(const_cast<RenderWidgetHost*>(widget)); | |
145 if (rvh->IsSubframe()) | |
146 Add(rvh); | |
147 } | |
148 } | 144 } |
149 } | 145 } |
150 | 146 |
151 // Then we register for notifications to get new guests. | 147 // Then we register for notifications to get new guests. |
152 registrar_.Add(this, content::NOTIFICATION_WEB_CONTENTS_CONNECTED, | 148 registrar_.Add(this, content::NOTIFICATION_WEB_CONTENTS_CONNECTED, |
153 content::NotificationService::AllBrowserContextsAndSources()); | 149 content::NotificationService::AllBrowserContextsAndSources()); |
154 registrar_.Add(this, content::NOTIFICATION_WEB_CONTENTS_DISCONNECTED, | 150 registrar_.Add(this, content::NOTIFICATION_WEB_CONTENTS_DISCONNECTED, |
155 content::NotificationService::AllBrowserContextsAndSources()); | 151 content::NotificationService::AllBrowserContextsAndSources()); |
156 } | 152 } |
157 | 153 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
204 break; | 200 break; |
205 case content::NOTIFICATION_WEB_CONTENTS_DISCONNECTED: | 201 case content::NOTIFICATION_WEB_CONTENTS_DISCONNECTED: |
206 Remove(web_contents->GetRenderViewHost()); | 202 Remove(web_contents->GetRenderViewHost()); |
207 break; | 203 break; |
208 default: | 204 default: |
209 NOTREACHED() << "Unexpected notification."; | 205 NOTREACHED() << "Unexpected notification."; |
210 } | 206 } |
211 } | 207 } |
212 | 208 |
213 } // namespace task_manager | 209 } // namespace task_manager |
OLD | NEW |