OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_information.h" | 5 #include "chrome/browser/task_manager/guest_information.h" |
6 | 6 |
7 #include "base/strings/string16.h" | 7 #include "base/strings/string16.h" |
8 #include "chrome/browser/chrome_notification_types.h" | 8 #include "chrome/browser/chrome_notification_types.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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 | 101 |
102 bool GuestInformation::CheckOwnership(WebContents* web_contents) { | 102 bool GuestInformation::CheckOwnership(WebContents* web_contents) { |
103 // Guest WebContentses are created and owned internally by the content layer. | 103 // Guest WebContentses are created and owned internally by the content layer. |
104 return GuestViewBase::IsGuest(web_contents); | 104 return GuestViewBase::IsGuest(web_contents); |
105 } | 105 } |
106 | 106 |
107 void GuestInformation::GetAll(const NewWebContentsCallback& callback) { | 107 void GuestInformation::GetAll(const NewWebContentsCallback& callback) { |
108 scoped_ptr<content::RenderWidgetHostIterator> widgets( | 108 scoped_ptr<content::RenderWidgetHostIterator> widgets( |
109 content::RenderWidgetHost::GetRenderWidgetHosts()); | 109 content::RenderWidgetHost::GetRenderWidgetHosts()); |
110 while (content::RenderWidgetHost* widget = widgets->GetNextHost()) { | 110 while (content::RenderWidgetHost* widget = widgets->GetNextHost()) { |
111 if (widget->IsRenderView()) { | 111 content::RenderViewHost* rvh = content::RenderViewHost::From(widget); |
112 content::RenderViewHost* rvh = content::RenderViewHost::From(widget); | 112 WebContents* web_contents = WebContents::FromRenderViewHost(rvh); |
113 WebContents* web_contents = WebContents::FromRenderViewHost(rvh); | 113 if (web_contents && GuestViewBase::IsGuest(web_contents)) |
114 if (web_contents && GuestViewBase::IsGuest(web_contents)) | 114 callback.Run(web_contents); |
115 callback.Run(web_contents); | |
116 } | |
117 } | 115 } |
118 } | 116 } |
119 | 117 |
120 scoped_ptr<RendererResource> GuestInformation::MakeResource( | 118 scoped_ptr<RendererResource> GuestInformation::MakeResource( |
121 WebContents* web_contents) { | 119 WebContents* web_contents) { |
122 return scoped_ptr<RendererResource>( | 120 return scoped_ptr<RendererResource>( |
123 new GuestResource(web_contents->GetRenderViewHost())); | 121 new GuestResource(web_contents->GetRenderViewHost())); |
124 } | 122 } |
125 | 123 |
126 } // namespace task_manager | 124 } // namespace task_manager |
OLD | NEW |