| 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_host.h" | 10 #include "chrome/browser/extensions/extension_host.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 WebContents* web_contents = WebContents::FromRenderViewHost(rvh); | 63 WebContents* web_contents = WebContents::FromRenderViewHost(rvh); |
| 64 if (!web_contents) | 64 if (!web_contents) |
| 65 return; // Orphan RVH will show up with no title/url/icon in clients. | 65 return; // Orphan RVH will show up with no title/url/icon in clients. |
| 66 | 66 |
| 67 title_ = base::UTF16ToUTF8(web_contents->GetTitle()); | 67 title_ = base::UTF16ToUTF8(web_contents->GetTitle()); |
| 68 url_ = web_contents->GetURL(); | 68 url_ = web_contents->GetURL(); |
| 69 content::NavigationController& controller = web_contents->GetController(); | 69 content::NavigationController& controller = web_contents->GetController(); |
| 70 content::NavigationEntry* entry = controller.GetActiveEntry(); | 70 content::NavigationEntry* entry = controller.GetActiveEntry(); |
| 71 if (entry != NULL && entry->GetURL().is_valid()) | 71 if (entry != NULL && entry->GetURL().is_valid()) |
| 72 favicon_url_ = entry->GetFavicon().url; | 72 favicon_url_ = entry->GetFavicon().url; |
| 73 last_activity_time_ = web_contents->GetLastSelectedTime(); | 73 last_activity_time_ = web_contents->GetLastActiveTime(); |
| 74 | 74 |
| 75 if (is_tab) { | 75 if (is_tab) { |
| 76 type_ = kTargetTypePage; | 76 type_ = kTargetTypePage; |
| 77 tab_id_ = extensions::ExtensionTabUtil::GetTabId(web_contents); | 77 tab_id_ = extensions::ExtensionTabUtil::GetTabId(web_contents); |
| 78 } else { | 78 } else { |
| 79 Profile* profile = | 79 Profile* profile = |
| 80 Profile::FromBrowserContext(web_contents->GetBrowserContext()); | 80 Profile::FromBrowserContext(web_contents->GetBrowserContext()); |
| 81 if (profile) { | 81 if (profile) { |
| 82 ExtensionService* extension_service = profile->GetExtensionService(); | 82 ExtensionService* extension_service = profile->GetExtensionService(); |
| 83 const extensions::Extension* extension = extension_service-> | 83 const extensions::Extension* extension = extension_service-> |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 | 322 |
| 323 // static | 323 // static |
| 324 void DevToolsTargetImpl::EnumerateAllTargets(Callback callback) { | 324 void DevToolsTargetImpl::EnumerateAllTargets(Callback callback) { |
| 325 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 325 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 326 content::BrowserThread::PostTask( | 326 content::BrowserThread::PostTask( |
| 327 content::BrowserThread::IO, | 327 content::BrowserThread::IO, |
| 328 FROM_HERE, | 328 FROM_HERE, |
| 329 base::Bind(&DevToolsTargetImpl::EnumerateWorkerTargets, | 329 base::Bind(&DevToolsTargetImpl::EnumerateWorkerTargets, |
| 330 base::Bind(&CollectAllTargets, callback))); | 330 base::Bind(&CollectAllTargets, callback))); |
| 331 } | 331 } |
| OLD | NEW |