| 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 "content/browser/devtools/devtools_http_handler_impl.h" | 5 #include "content/browser/devtools/devtools_http_handler_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 namespace content { | 47 namespace content { |
| 48 | 48 |
| 49 namespace { | 49 namespace { |
| 50 | 50 |
| 51 const char kDevToolsHandlerThreadName[] = "Chrome_DevToolsHandlerThread"; | 51 const char kDevToolsHandlerThreadName[] = "Chrome_DevToolsHandlerThread"; |
| 52 | 52 |
| 53 const char kThumbUrlPrefix[] = "/thumb/"; | 53 const char kThumbUrlPrefix[] = "/thumb/"; |
| 54 const char kPageUrlPrefix[] = "/devtools/page/"; | 54 const char kPageUrlPrefix[] = "/devtools/page/"; |
| 55 | 55 |
| 56 const char kTargetIdField[] = "id"; | 56 const char kTargetIdField[] = "id"; |
| 57 const char kTargetParentIdField[] = "parentId"; |
| 57 const char kTargetTypeField[] = "type"; | 58 const char kTargetTypeField[] = "type"; |
| 58 const char kTargetTitleField[] = "title"; | 59 const char kTargetTitleField[] = "title"; |
| 59 const char kTargetDescriptionField[] = "description"; | 60 const char kTargetDescriptionField[] = "description"; |
| 60 const char kTargetUrlField[] = "url"; | 61 const char kTargetUrlField[] = "url"; |
| 61 const char kTargetThumbnailUrlField[] = "thumbnailUrl"; | 62 const char kTargetThumbnailUrlField[] = "thumbnailUrl"; |
| 62 const char kTargetFaviconUrlField[] = "faviconUrl"; | 63 const char kTargetFaviconUrlField[] = "faviconUrl"; |
| 63 const char kTargetWebSocketDebuggerUrlField[] = "webSocketDebuggerUrl"; | 64 const char kTargetWebSocketDebuggerUrlField[] = "webSocketDebuggerUrl"; |
| 64 const char kTargetDevtoolsFrontendUrlField[] = "devtoolsFrontendUrl"; | 65 const char kTargetDevtoolsFrontendUrlField[] = "devtoolsFrontendUrl"; |
| 65 | 66 |
| 66 // An internal implementation of DevToolsClientHost that delegates | 67 // An internal implementation of DevToolsClientHost that delegates |
| (...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 746 connection_id, request)); | 747 connection_id, request)); |
| 747 } | 748 } |
| 748 | 749 |
| 749 base::DictionaryValue* DevToolsHttpHandlerImpl::SerializeTarget( | 750 base::DictionaryValue* DevToolsHttpHandlerImpl::SerializeTarget( |
| 750 const DevToolsTarget& target, | 751 const DevToolsTarget& target, |
| 751 const std::string& host) { | 752 const std::string& host) { |
| 752 base::DictionaryValue* dictionary = new base::DictionaryValue; | 753 base::DictionaryValue* dictionary = new base::DictionaryValue; |
| 753 | 754 |
| 754 std::string id = target.GetId(); | 755 std::string id = target.GetId(); |
| 755 dictionary->SetString(kTargetIdField, id); | 756 dictionary->SetString(kTargetIdField, id); |
| 757 std::string parent_id = target.GetParentId(); |
| 758 if (!parent_id.empty()) |
| 759 dictionary->SetString(kTargetParentIdField, parent_id); |
| 756 dictionary->SetString(kTargetTypeField, target.GetType()); | 760 dictionary->SetString(kTargetTypeField, target.GetType()); |
| 757 dictionary->SetString(kTargetTitleField, | 761 dictionary->SetString(kTargetTitleField, |
| 758 net::EscapeForHTML(target.GetTitle())); | 762 net::EscapeForHTML(target.GetTitle())); |
| 759 dictionary->SetString(kTargetDescriptionField, target.GetDescription()); | 763 dictionary->SetString(kTargetDescriptionField, target.GetDescription()); |
| 760 | 764 |
| 761 GURL url = target.GetURL(); | 765 GURL url = target.GetURL(); |
| 762 dictionary->SetString(kTargetUrlField, url.spec()); | 766 dictionary->SetString(kTargetUrlField, url.spec()); |
| 763 | 767 |
| 764 GURL favicon_url = target.GetFaviconURL(); | 768 GURL favicon_url = target.GetFaviconURL(); |
| 765 if (favicon_url.is_valid()) | 769 if (favicon_url.is_valid()) |
| (...skipping 14 matching lines...) Expand all Loading... |
| 780 id.c_str(), | 784 id.c_str(), |
| 781 host); | 785 host); |
| 782 dictionary->SetString( | 786 dictionary->SetString( |
| 783 kTargetDevtoolsFrontendUrlField, devtools_frontend_url); | 787 kTargetDevtoolsFrontendUrlField, devtools_frontend_url); |
| 784 } | 788 } |
| 785 | 789 |
| 786 return dictionary; | 790 return dictionary; |
| 787 } | 791 } |
| 788 | 792 |
| 789 } // namespace content | 793 } // namespace content |
| OLD | NEW |