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 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 : attached(false) { | 399 : attached(false) { |
400 } | 400 } |
401 | 401 |
402 std::string id; | 402 std::string id; |
403 std::string url; | 403 std::string url; |
404 std::string type; | 404 std::string type; |
405 bool attached; | 405 bool attached; |
406 std::string title; | 406 std::string title; |
407 std::string thumbnail_url; | 407 std::string thumbnail_url; |
408 std::string favicon_url; | 408 std::string favicon_url; |
| 409 std::string description; |
409 base::TimeTicks last_selected_time; | 410 base::TimeTicks last_selected_time; |
410 }; | 411 }; |
411 | 412 |
412 // static | 413 // static |
413 bool DevToolsHttpHandlerImpl::SortPageListByTime(const PageInfo& info1, | 414 bool DevToolsHttpHandlerImpl::SortPageListByTime(const PageInfo& info1, |
414 const PageInfo& info2) { | 415 const PageInfo& info2) { |
415 return info1.last_selected_time > info2.last_selected_time; | 416 return info1.last_selected_time > info2.last_selected_time; |
416 } | 417 } |
417 | 418 |
418 DevToolsHttpHandlerImpl::PageList DevToolsHttpHandlerImpl::GeneratePageList() { | 419 DevToolsHttpHandlerImpl::PageList DevToolsHttpHandlerImpl::GeneratePageList() { |
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
863 net::EscapeForHTML(web_contents->GetTitle())); | 864 net::EscapeForHTML(web_contents->GetTitle())); |
864 page_info.last_selected_time = web_contents->GetLastSelectedTime(); | 865 page_info.last_selected_time = web_contents->GetLastSelectedTime(); |
865 | 866 |
866 NavigationController& controller = web_contents->GetController(); | 867 NavigationController& controller = web_contents->GetController(); |
867 NavigationEntry* entry = controller.GetActiveEntry(); | 868 NavigationEntry* entry = controller.GetActiveEntry(); |
868 if (entry != NULL && entry->GetURL().is_valid()) { | 869 if (entry != NULL && entry->GetURL().is_valid()) { |
869 page_info.thumbnail_url = "/thumb/" + entry->GetURL().spec(); | 870 page_info.thumbnail_url = "/thumb/" + entry->GetURL().spec(); |
870 page_info.favicon_url = entry->GetFavicon().url.spec(); | 871 page_info.favicon_url = entry->GetFavicon().url.spec(); |
871 } | 872 } |
872 } | 873 } |
| 874 |
| 875 page_info.description = delegate_->GetViewDescription(rvh); |
| 876 |
873 return page_info; | 877 return page_info; |
874 } | 878 } |
875 | 879 |
876 base::DictionaryValue* DevToolsHttpHandlerImpl::SerializePageInfo( | 880 base::DictionaryValue* DevToolsHttpHandlerImpl::SerializePageInfo( |
877 const PageInfo& page_info, | 881 const PageInfo& page_info, |
878 const std::string& host) { | 882 const std::string& host) { |
879 base::DictionaryValue* dictionary = new base::DictionaryValue; | 883 base::DictionaryValue* dictionary = new base::DictionaryValue; |
880 dictionary->SetString("title", page_info.title); | 884 dictionary->SetString("title", page_info.title); |
881 dictionary->SetString("url", page_info.url); | 885 dictionary->SetString("url", page_info.url); |
882 dictionary->SetString("type", page_info.type); | 886 dictionary->SetString("type", page_info.type); |
883 dictionary->SetString("id", page_info.id); | 887 dictionary->SetString("id", page_info.id); |
884 dictionary->SetString("thumbnailUrl", page_info.thumbnail_url); | 888 dictionary->SetString("thumbnailUrl", page_info.thumbnail_url); |
885 dictionary->SetString("faviconUrl", page_info.favicon_url); | 889 dictionary->SetString("faviconUrl", page_info.favicon_url); |
886 if (!page_info.attached) { | 890 if (!page_info.attached) { |
887 dictionary->SetString("webSocketDebuggerUrl", | 891 dictionary->SetString("webSocketDebuggerUrl", |
888 base::StringPrintf("ws://%s/devtools/page/%s", | 892 base::StringPrintf("ws://%s/devtools/page/%s", |
889 host.c_str(), | 893 host.c_str(), |
890 page_info.id.c_str())); | 894 page_info.id.c_str())); |
891 std::string devtools_frontend_url = GetFrontendURLInternal( | 895 std::string devtools_frontend_url = GetFrontendURLInternal( |
892 page_info.id.c_str(), | 896 page_info.id.c_str(), |
893 host); | 897 host); |
894 dictionary->SetString("devtoolsFrontendUrl", devtools_frontend_url); | 898 dictionary->SetString("devtoolsFrontendUrl", devtools_frontend_url); |
895 } | 899 } |
| 900 dictionary->SetString("description", page_info.description); |
896 return dictionary; | 901 return dictionary; |
897 } | 902 } |
898 | 903 |
899 } // namespace content | 904 } // namespace content |
OLD | NEW |