OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ui/webui/inspect_ui.h" | 5 #include "chrome/browser/ui/webui/inspect_ui.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 | 108 |
109 return target_data; | 109 return target_data; |
110 } | 110 } |
111 | 111 |
112 bool HasClientHost(RenderViewHost* rvh) { | 112 bool HasClientHost(RenderViewHost* rvh) { |
113 if (!DevToolsAgentHost::HasFor(rvh)) | 113 if (!DevToolsAgentHost::HasFor(rvh)) |
114 return false; | 114 return false; |
115 | 115 |
116 scoped_refptr<DevToolsAgentHost> agent( | 116 scoped_refptr<DevToolsAgentHost> agent( |
117 DevToolsAgentHost::GetOrCreateFor(rvh)); | 117 DevToolsAgentHost::GetOrCreateFor(rvh)); |
118 return !!DevToolsManager::GetInstance()->GetDevToolsClientHostFor(agent); | 118 return agent->IsAttached(); |
119 } | 119 } |
120 | 120 |
121 DictionaryValue* BuildTargetDescriptor(RenderViewHost* rvh, bool is_tab) { | 121 DictionaryValue* BuildTargetDescriptor(RenderViewHost* rvh, bool is_tab) { |
122 WebContents* web_contents = WebContents::FromRenderViewHost(rvh); | 122 WebContents* web_contents = WebContents::FromRenderViewHost(rvh); |
123 std::string title; | 123 std::string title; |
124 std::string target_type = is_tab ? kPageTargetType : ""; | 124 std::string target_type = is_tab ? kPageTargetType : ""; |
125 GURL url; | 125 GURL url; |
126 GURL favicon_url; | 126 GURL favicon_url; |
127 if (web_contents) { | 127 if (web_contents) { |
128 url = web_contents->GetURL(); | 128 url = web_contents->GetURL(); |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 const content::WebUIDataSource::GotDataCallback& callback, | 480 const content::WebUIDataSource::GotDataCallback& callback, |
481 int result_code, | 481 int result_code, |
482 const std::string& response) { | 482 const std::string& response) { |
483 ListValue result; | 483 ListValue result; |
484 result.AppendInteger(result_code); | 484 result.AppendInteger(result_code); |
485 result.AppendString(response); | 485 result.AppendString(response); |
486 std::string json_string; | 486 std::string json_string; |
487 base::JSONWriter::Write(&result, &json_string); | 487 base::JSONWriter::Write(&result, &json_string); |
488 callback.Run(base::RefCountedString::TakeString(&json_string)); | 488 callback.Run(base::RefCountedString::TakeString(&json_string)); |
489 } | 489 } |
OLD | NEW |