| 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/strings/string16.h" | 7 #include "base/strings/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 (size_t i = 0; i < widgets.size(); ++i) { |
| 137 !i.IsAtEnd(); i.Advance()) { | 137 if (widgets[i]->IsRenderView()) { |
| 138 RenderProcessHost::RenderWidgetHostsIterator iter = | 138 RenderViewHost* rvh = RenderViewHost::From(widgets[i]); |
| 139 i.GetCurrentValue()->GetRenderWidgetHostsIterator(); | 139 if (rvh->IsSubframe()) |
| 140 for (; !iter.IsAtEnd(); iter.Advance()) { | 140 Add(rvh); |
| 141 const RenderWidgetHost* widget = iter.GetCurrentValue(); | |
| 142 if (widget->IsRenderView()) { | |
| 143 RenderViewHost* rvh = | |
| 144 RenderViewHost::From(const_cast<RenderWidgetHost*>(widget)); | |
| 145 if (rvh->IsSubframe()) | |
| 146 Add(rvh); | |
| 147 } | |
| 148 } | 141 } |
| 149 } | 142 } |
| 150 | 143 |
| 151 // Then we register for notifications to get new guests. | 144 // Then we register for notifications to get new guests. |
| 152 registrar_.Add(this, content::NOTIFICATION_WEB_CONTENTS_CONNECTED, | 145 registrar_.Add(this, content::NOTIFICATION_WEB_CONTENTS_CONNECTED, |
| 153 content::NotificationService::AllBrowserContextsAndSources()); | 146 content::NotificationService::AllBrowserContextsAndSources()); |
| 154 registrar_.Add(this, content::NOTIFICATION_WEB_CONTENTS_DISCONNECTED, | 147 registrar_.Add(this, content::NOTIFICATION_WEB_CONTENTS_DISCONNECTED, |
| 155 content::NotificationService::AllBrowserContextsAndSources()); | 148 content::NotificationService::AllBrowserContextsAndSources()); |
| 156 } | 149 } |
| 157 | 150 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 break; | 197 break; |
| 205 case content::NOTIFICATION_WEB_CONTENTS_DISCONNECTED: | 198 case content::NOTIFICATION_WEB_CONTENTS_DISCONNECTED: |
| 206 Remove(web_contents->GetRenderViewHost()); | 199 Remove(web_contents->GetRenderViewHost()); |
| 207 break; | 200 break; |
| 208 default: | 201 default: |
| 209 NOTREACHED() << "Unexpected notification."; | 202 NOTREACHED() << "Unexpected notification."; |
| 210 } | 203 } |
| 211 } | 204 } |
| 212 | 205 |
| 213 } // namespace task_manager | 206 } // namespace task_manager |
| OLD | NEW |