| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/debugger/devtools_remote_service.h" | 5 #include "chrome/browser/debugger/devtools_remote_service.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
| 10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 const InspectableTabProxy::TabMap& tab_map = | 80 const InspectableTabProxy::TabMap& tab_map = |
| 81 delegate_->inspectable_tab_proxy()->tab_map(); | 81 delegate_->inspectable_tab_proxy()->tab_map(); |
| 82 for (InspectableTabProxy::TabMap::const_iterator it = | 82 for (InspectableTabProxy::TabMap::const_iterator it = |
| 83 tab_map.begin(), end = tab_map.end(); it != end; ++it) { | 83 tab_map.begin(), end = tab_map.end(); it != end; ++it) { |
| 84 NavigationEntry* entry = it->second->controller().GetActiveEntry(); | 84 NavigationEntry* entry = it->second->controller().GetActiveEntry(); |
| 85 if (entry == NULL) { | 85 if (entry == NULL) { |
| 86 continue; | 86 continue; |
| 87 } | 87 } |
| 88 if (entry->url().is_valid()) { | 88 if (entry->url().is_valid()) { |
| 89 ListValue* tab = new ListValue(); | 89 ListValue* tab = new ListValue(); |
| 90 tab->Append(Value::CreateIntegerValue( | 90 tab->Append(base::NumberValue::New( |
| 91 it->second->restore_tab_helper()->session_id().id())); | 91 it->second->restore_tab_helper()->session_id().id())); |
| 92 tab->Append(Value::CreateStringValue(entry->url().spec())); | 92 tab->Append(base::StringValue::New(entry->url().spec())); |
| 93 data->Append(tab); | 93 data->Append(tab); |
| 94 } | 94 } |
| 95 } | 95 } |
| 96 response.SetInteger(kResultKey, Result::kOk); | 96 response.SetInteger(kResultKey, Result::kOk); |
| 97 response.Set(kDataKey, data); | 97 response.Set(kDataKey, data); |
| 98 } else { | 98 } else { |
| 99 // Unknown protocol command. | 99 // Unknown protocol command. |
| 100 NOTREACHED(); | 100 NOTREACHED(); |
| 101 response.SetInteger(kResultKey, Result::kUnknownCommand); | 101 response.SetInteger(kResultKey, Result::kUnknownCommand); |
| 102 } | 102 } |
| 103 std::string response_json; | 103 std::string response_json; |
| 104 base::JSONWriter::Write(&response, false, &response_json); | 104 base::JSONWriter::Write(&response, false, &response_json); |
| 105 scoped_ptr<DevToolsRemoteMessage> response_message( | 105 scoped_ptr<DevToolsRemoteMessage> response_message( |
| 106 DevToolsRemoteMessageBuilder::instance().Create(message.tool(), | 106 DevToolsRemoteMessageBuilder::instance().Create(message.tool(), |
| 107 message.destination(), | 107 message.destination(), |
| 108 response_json)); | 108 response_json)); |
| 109 delegate_->Send(*response_message.get()); | 109 delegate_->Send(*response_message.get()); |
| 110 } | 110 } |
| OLD | NEW |