| 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 } | 124 } |
| 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 scoped_ptr<RenderWidgetHost::List> hosts = |
| 135 for (RenderProcessHost::iterator i( | 135 RenderWidgetHost::GetRenderWidgetHosts(); |
| 136 RenderProcessHost::AllHostsIterator()); | 136 for (RenderWidgetHost::List::const_iterator it = hosts->begin(); |
| 137 !i.IsAtEnd(); i.Advance()) { | 137 it != hosts->end(); |
| 138 RenderProcessHost::RenderWidgetHostsIterator iter = | 138 ++it) { |
| 139 i.GetCurrentValue()->GetRenderWidgetHostsIterator(); | 139 const RenderWidgetHost* widget = *it; |
| 140 for (; !iter.IsAtEnd(); iter.Advance()) { | 140 if (widget->IsRenderView()) { |
| 141 const RenderWidgetHost* widget = iter.GetCurrentValue(); | 141 RenderViewHost* rvh = |
| 142 if (widget->IsRenderView()) { | 142 RenderViewHost::From(const_cast<RenderWidgetHost*>(widget)); |
| 143 RenderViewHost* rvh = | 143 if (rvh->IsSubframe()) |
| 144 RenderViewHost::From(const_cast<RenderWidgetHost*>(widget)); | 144 Add(rvh); |
| 145 if (rvh->IsSubframe()) | |
| 146 Add(rvh); | |
| 147 } | |
| 148 } | 145 } |
| 149 } | 146 } |
| 150 | 147 |
| 151 // Then we register for notifications to get new guests. | 148 // Then we register for notifications to get new guests. |
| 152 registrar_.Add(this, content::NOTIFICATION_WEB_CONTENTS_CONNECTED, | 149 registrar_.Add(this, content::NOTIFICATION_WEB_CONTENTS_CONNECTED, |
| 153 content::NotificationService::AllBrowserContextsAndSources()); | 150 content::NotificationService::AllBrowserContextsAndSources()); |
| 154 registrar_.Add(this, content::NOTIFICATION_WEB_CONTENTS_DISCONNECTED, | 151 registrar_.Add(this, content::NOTIFICATION_WEB_CONTENTS_DISCONNECTED, |
| 155 content::NotificationService::AllBrowserContextsAndSources()); | 152 content::NotificationService::AllBrowserContextsAndSources()); |
| 156 } | 153 } |
| 157 | 154 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 break; | 201 break; |
| 205 case content::NOTIFICATION_WEB_CONTENTS_DISCONNECTED: | 202 case content::NOTIFICATION_WEB_CONTENTS_DISCONNECTED: |
| 206 Remove(web_contents->GetRenderViewHost()); | 203 Remove(web_contents->GetRenderViewHost()); |
| 207 break; | 204 break; |
| 208 default: | 205 default: |
| 209 NOTREACHED() << "Unexpected notification."; | 206 NOTREACHED() << "Unexpected notification."; |
| 210 } | 207 } |
| 211 } | 208 } |
| 212 | 209 |
| 213 } // namespace task_manager | 210 } // namespace task_manager |
| OLD | NEW |