| 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_target_impl.h" | 5 #include "chrome/browser/devtools/devtools_target_impl.h" |
| 6 | 6 |
| 7 #include "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "chrome/browser/devtools/devtools_window.h" | 9 #include "chrome/browser/devtools/devtools_window.h" |
| 10 #include "chrome/browser/extensions/extension_tab_util.h" | 10 #include "chrome/browser/extensions/extension_tab_util.h" |
| 11 #include "chrome/browser/guest_view/guest_view_base.h" | |
| 12 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
| 13 #include "chrome/browser/ui/tab_contents/tab_contents_iterator.h" | 12 #include "chrome/browser/ui/tab_contents/tab_contents_iterator.h" |
| 14 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" | 13 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" |
| 15 #include "chrome/common/extensions/extension_constants.h" | 14 #include "chrome/common/extensions/extension_constants.h" |
| 16 #include "content/public/browser/browser_thread.h" | 15 #include "content/public/browser/browser_thread.h" |
| 17 #include "content/public/browser/favicon_status.h" | 16 #include "content/public/browser/favicon_status.h" |
| 18 #include "content/public/browser/navigation_entry.h" | 17 #include "content/public/browser/navigation_entry.h" |
| 19 #include "content/public/browser/render_frame_host.h" | 18 #include "content/public/browser/render_frame_host.h" |
| 20 #include "content/public/browser/render_view_host.h" | 19 #include "content/public/browser/render_view_host.h" |
| 21 #include "content/public/browser/web_contents.h" | 20 #include "content/public/browser/web_contents.h" |
| 22 #include "extensions/browser/extension_host.h" | 21 #include "extensions/browser/extension_host.h" |
| 23 #include "extensions/browser/extension_registry.h" | 22 #include "extensions/browser/extension_registry.h" |
| 24 #include "extensions/browser/extension_system.h" | 23 #include "extensions/browser/extension_system.h" |
| 24 #include "extensions/browser/guest_view/guest_view_base.h" |
| 25 #include "extensions/browser/process_manager.h" | 25 #include "extensions/browser/process_manager.h" |
| 26 #include "extensions/common/constants.h" | 26 #include "extensions/common/constants.h" |
| 27 | 27 |
| 28 using content::BrowserThread; | 28 using content::BrowserThread; |
| 29 using content::DevToolsAgentHost; | 29 using content::DevToolsAgentHost; |
| 30 using content::RenderViewHost; | 30 using content::RenderViewHost; |
| 31 using content::WebContents; | 31 using content::WebContents; |
| 32 using content::WorkerService; | 32 using content::WorkerService; |
| 33 | 33 |
| 34 namespace { | 34 namespace { |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 } | 78 } |
| 79 | 79 |
| 80 set_title(base::UTF16ToUTF8(web_contents->GetTitle())); | 80 set_title(base::UTF16ToUTF8(web_contents->GetTitle())); |
| 81 set_url(web_contents->GetURL()); | 81 set_url(web_contents->GetURL()); |
| 82 content::NavigationController& controller = web_contents->GetController(); | 82 content::NavigationController& controller = web_contents->GetController(); |
| 83 content::NavigationEntry* entry = controller.GetActiveEntry(); | 83 content::NavigationEntry* entry = controller.GetActiveEntry(); |
| 84 if (entry != NULL && entry->GetURL().is_valid()) | 84 if (entry != NULL && entry->GetURL().is_valid()) |
| 85 set_favicon_url(entry->GetFavicon().url); | 85 set_favicon_url(entry->GetFavicon().url); |
| 86 set_last_activity_time(web_contents->GetLastActiveTime()); | 86 set_last_activity_time(web_contents->GetLastActiveTime()); |
| 87 | 87 |
| 88 GuestViewBase* guest = GuestViewBase::FromWebContents(web_contents); | 88 extensions::GuestViewBase* guest = |
| 89 extensions::GuestViewBase::FromWebContents(web_contents); |
| 89 WebContents* guest_contents = guest ? guest->embedder_web_contents() : NULL; | 90 WebContents* guest_contents = guest ? guest->embedder_web_contents() : NULL; |
| 90 if (guest_contents) { | 91 if (guest_contents) { |
| 91 set_type(kTargetTypeWebView); | 92 set_type(kTargetTypeWebView); |
| 92 set_parent_id(DevToolsAgentHost::GetOrCreateFor(guest_contents)->GetId()); | 93 set_parent_id(DevToolsAgentHost::GetOrCreateFor(guest_contents)->GetId()); |
| 93 return; | 94 return; |
| 94 } | 95 } |
| 95 | 96 |
| 96 if (is_tab) { | 97 if (is_tab) { |
| 97 set_type(kTargetTypePage); | 98 set_type(kTargetTypePage); |
| 98 tab_id_ = extensions::ExtensionTabUtil::GetTabId(web_contents); | 99 tab_id_ = extensions::ExtensionTabUtil::GetTabId(web_contents); |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 | 349 |
| 349 // static | 350 // static |
| 350 void DevToolsTargetImpl::EnumerateAllTargets(Callback callback) { | 351 void DevToolsTargetImpl::EnumerateAllTargets(Callback callback) { |
| 351 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 352 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 352 content::BrowserThread::PostTask( | 353 content::BrowserThread::PostTask( |
| 353 content::BrowserThread::IO, | 354 content::BrowserThread::IO, |
| 354 FROM_HERE, | 355 FROM_HERE, |
| 355 base::Bind(&DevToolsTargetImpl::EnumerateWorkerTargets, | 356 base::Bind(&DevToolsTargetImpl::EnumerateWorkerTargets, |
| 356 base::Bind(&CollectAllTargets, callback))); | 357 base::Bind(&CollectAllTargets, callback))); |
| 357 } | 358 } |
| OLD | NEW |