Index: content/browser/devtools/devtools_agent_host_impl.cc |
diff --git a/content/browser/devtools/devtools_agent_host_impl.cc b/content/browser/devtools/devtools_agent_host_impl.cc |
index 0474103a4232e1c39c790fda2d4acd26b2442466..86d41f8088ffd9b82a9c692db72fc9e46f3a175e 100644 |
--- a/content/browser/devtools/devtools_agent_host_impl.cc |
+++ b/content/browser/devtools/devtools_agent_host_impl.cc |
@@ -5,7 +5,15 @@ |
#include "content/browser/devtools/devtools_agent_host_impl.h" |
#include "base/basictypes.h" |
+#include "base/utf_string_conversions.h" |
+#include "content/browser/renderer_host/render_view_host_delegate.h" |
#include "content/common/devtools_messages.h" |
+#include "content/public/browser/devtools_manager.h" |
+#include "content/public/browser/favicon_status.h" |
+#include "content/public/browser/navigation_entry.h" |
+#include "content/public/browser/render_view_host.h" |
+#include "content/public/browser/web_contents.h" |
+#include "net/base/escape.h" |
namespace content { |
@@ -54,6 +62,38 @@ void DevToolsAgentHostImpl::AddMessageToConsole(ConsoleMessageLevel level, |
message)); |
} |
+bool DevToolsAgentHostImpl::attached() { |
+ return !!DevToolsManager::GetInstance()->GetDevToolsClientHostFor(this); |
+} |
+ |
+std::string DevToolsAgentHostImpl::title() { |
+ WebContents* web_contents = GetWebContents(); |
+ if (!web_contents) |
+ return ""; |
+ |
+ return UTF16ToUTF8(net::EscapeForHTML(web_contents->GetTitle())); |
+} |
+ |
+GURL DevToolsAgentHostImpl::url() { |
+ return GetRenderViewHost()->GetDelegate()->GetURL(); |
pfeldman
2013/03/01 08:49:30
Like this will return NULL for workers.
Vladislav Kaznacheev
2013/03/01 12:58:35
Done.
|
+} |
+ |
+GURL DevToolsAgentHostImpl::thumbnail_url() { |
+ NavigationEntry* entry = GetNavigationEntry(); |
+ if (!entry) |
+ return GURL(); |
+ |
+ return GURL("/thumb/" + entry->GetURL().spec()); |
+} |
+ |
+GURL DevToolsAgentHostImpl::favicon_url() { |
+ NavigationEntry* entry = GetNavigationEntry(); |
+ if (!entry) |
+ return GURL(); |
+ |
+ return entry->GetFavicon().url; |
+} |
+ |
RenderViewHost* DevToolsAgentHostImpl::GetRenderViewHost() { |
return NULL; |
} |
@@ -66,4 +106,21 @@ void DevToolsAgentHostImpl::NotifyCloseListener() { |
} |
} |
+WebContents* DevToolsAgentHostImpl::GetWebContents() { |
+ return GetRenderViewHost()->GetDelegate()->GetAsWebContents(); |
+} |
+ |
+NavigationEntry* DevToolsAgentHostImpl::GetNavigationEntry() { |
+ WebContents* web_contents = GetWebContents(); |
+ if (!web_contents) |
+ return NULL; |
+ |
+ NavigationController& controller = web_contents->GetController(); |
+ NavigationEntry* entry = controller.GetActiveEntry(); |
+ if (!entry || !entry->GetURL().is_valid()) |
+ return NULL; |
+ |
+ return entry; |
+} |
+ |
} // namespace content |