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/devtools/devtools_targets_ui.h" | 5 #include "chrome/browser/devtools/devtools_targets_ui.h" |
6 | 6 |
7 #include "base/memory/weak_ptr.h" | 7 #include "base/memory/weak_ptr.h" |
8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
11 #include "base/version.h" | 11 #include "base/version.h" |
12 #include "chrome/browser/devtools/device/devtools_android_bridge.h" | 12 #include "chrome/browser/devtools/device/devtools_android_bridge.h" |
13 #include "chrome/browser/devtools/devtools_target_impl.h" | 13 #include "chrome/browser/devtools/devtools_target_impl.h" |
| 14 #include "chrome/browser/guest_view/guest_view_base.h" |
14 #include "chrome/common/chrome_version_info.h" | 15 #include "chrome/common/chrome_version_info.h" |
15 #include "content/public/browser/browser_child_process_observer.h" | 16 #include "content/public/browser/browser_child_process_observer.h" |
16 #include "content/public/browser/browser_thread.h" | 17 #include "content/public/browser/browser_thread.h" |
17 #include "content/public/browser/child_process_data.h" | 18 #include "content/public/browser/child_process_data.h" |
18 #include "content/public/browser/notification_observer.h" | 19 #include "content/public/browser/notification_observer.h" |
19 #include "content/public/browser/notification_registrar.h" | 20 #include "content/public/browser/notification_registrar.h" |
20 #include "content/public/browser/notification_service.h" | 21 #include "content/public/browser/notification_service.h" |
21 #include "content/public/browser/notification_source.h" | 22 #include "content/public/browser/notification_source.h" |
22 #include "content/public/browser/notification_types.h" | 23 #include "content/public/browser/notification_types.h" |
23 #include "content/public/browser/render_frame_host.h" | 24 #include "content/public/browser/render_frame_host.h" |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 list_value->Append(descriptor); | 169 list_value->Append(descriptor); |
169 } | 170 } |
170 } | 171 } |
171 | 172 |
172 // Add the list of nested targets to each of its owners. | 173 // Add the list of nested targets to each of its owners. |
173 for (std::vector<RenderFrameHost*>::iterator it(nested_frames.begin()); | 174 for (std::vector<RenderFrameHost*>::iterator it(nested_frames.begin()); |
174 it != nested_frames.end(); ++it) { | 175 it != nested_frames.end(); ++it) { |
175 RenderFrameHost* rfh = (*it); | 176 RenderFrameHost* rfh = (*it); |
176 RenderFrameHost* parent_rfh = NULL; | 177 RenderFrameHost* parent_rfh = NULL; |
177 content::RenderViewHost* rvh = rfh->GetRenderViewHost(); | 178 content::RenderViewHost* rvh = rfh->GetRenderViewHost(); |
178 if (rvh->GetProcess()->IsGuest()) { | 179 WebContents* nested_web_contents = WebContents::FromRenderViewHost(rvh); |
179 WebContents* nested_web_contents = WebContents::FromRenderViewHost(rvh); | 180 GuestViewBase* guest = GuestViewBase::FromWebContents(nested_web_contents); |
180 WebContents* embedder = nested_web_contents->GetEmbedderWebContents(); | 181 if (guest) { |
| 182 WebContents* embedder = guest->embedder_web_contents(); |
181 parent_rfh = embedder->GetRenderViewHost()->GetMainFrame(); | 183 parent_rfh = embedder->GetRenderViewHost()->GetMainFrame(); |
182 } else { | 184 } else { |
183 parent_rfh = rfh->GetParent(); | 185 parent_rfh = rfh->GetParent(); |
184 DCHECK(parent_rfh); | 186 DCHECK(parent_rfh); |
185 } | 187 } |
186 if (parent_rfh && rfh_to_descriptor.count(parent_rfh) > 0) { | 188 if (parent_rfh && rfh_to_descriptor.count(parent_rfh) > 0) { |
187 base::DictionaryValue* parent = rfh_to_descriptor[parent_rfh]; | 189 base::DictionaryValue* parent = rfh_to_descriptor[parent_rfh]; |
188 base::ListValue* guests = NULL; | 190 base::ListValue* guests = NULL; |
189 if (!parent->GetList(kGuestList, &guests)) { | 191 if (!parent->GetList(kGuestList, &guests)) { |
190 guests = new base::ListValue(); | 192 guests = new base::ListValue(); |
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
597 base::StringPrintf("%d", it->first), it->second); | 599 base::StringPrintf("%d", it->first), it->second); |
598 } | 600 } |
599 | 601 |
600 std::string device_id = base::StringPrintf( | 602 std::string device_id = base::StringPrintf( |
601 kAdbDeviceIdFormat, | 603 kAdbDeviceIdFormat, |
602 sit->first.c_str()); | 604 sit->first.c_str()); |
603 result.Set(device_id, device_status_dict); | 605 result.Set(device_id, device_status_dict); |
604 } | 606 } |
605 callback_.Run(result); | 607 callback_.Run(result); |
606 } | 608 } |
OLD | NEW |