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 // Implements the Chrome Extensions Debugger API. | 5 // Implements the Chrome Extensions Debugger API. |
6 | 6 |
7 #include "chrome/browser/extensions/extension_debugger_api.h" | 7 #include "chrome/browser/extensions/extension_debugger_api.h" |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 return tab_contents == tab_contents_ && extension_id_ == extension_id; | 141 return tab_contents == tab_contents_ && extension_id_ == extension_id; |
142 } | 142 } |
143 | 143 |
144 // DevToolsClientHost interface | 144 // DevToolsClientHost interface |
145 void ExtensionDevToolsClientHost::InspectedTabClosing() { | 145 void ExtensionDevToolsClientHost::InspectedTabClosing() { |
146 // Tell extension that this client host has been detached. | 146 // Tell extension that this client host has been detached. |
147 Profile* profile = | 147 Profile* profile = |
148 Profile::FromBrowserContext(tab_contents_->browser_context()); | 148 Profile::FromBrowserContext(tab_contents_->browser_context()); |
149 if (profile != NULL && profile->GetExtensionEventRouter()) { | 149 if (profile != NULL && profile->GetExtensionEventRouter()) { |
150 ListValue args; | 150 ListValue args; |
151 args.Append(Value::CreateIntegerValue(tab_id_)); | 151 args.Append(base::NumberValue::New(tab_id_)); |
152 | 152 |
153 std::string json_args; | 153 std::string json_args; |
154 base::JSONWriter::Write(&args, false, &json_args); | 154 base::JSONWriter::Write(&args, false, &json_args); |
155 | 155 |
156 profile->GetExtensionEventRouter()->DispatchEventToExtension( | 156 profile->GetExtensionEventRouter()->DispatchEventToExtension( |
157 extension_id_, keys::kOnDetach, json_args, profile, GURL()); | 157 extension_id_, keys::kOnDetach, json_args, profile, GURL()); |
158 } | 158 } |
159 delete this; | 159 delete this; |
160 } | 160 } |
161 | 161 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 return; | 218 return; |
219 DictionaryValue* dictionary = static_cast<DictionaryValue*>(result.get()); | 219 DictionaryValue* dictionary = static_cast<DictionaryValue*>(result.get()); |
220 | 220 |
221 int id; | 221 int id; |
222 if (!dictionary->GetInteger("id", &id)) { | 222 if (!dictionary->GetInteger("id", &id)) { |
223 std::string method_name; | 223 std::string method_name; |
224 if (!dictionary->GetString("method", &method_name)) | 224 if (!dictionary->GetString("method", &method_name)) |
225 return; | 225 return; |
226 | 226 |
227 ListValue args; | 227 ListValue args; |
228 args.Append(Value::CreateIntegerValue(tab_id_)); | 228 args.Append(base::NumberValue::New(tab_id_)); |
229 args.Append(Value::CreateStringValue(method_name)); | 229 args.Append(base::StringValue::New(method_name)); |
230 Value* params_value; | 230 Value* params_value; |
231 if (dictionary->Get("params", ¶ms_value)) | 231 if (dictionary->Get("params", ¶ms_value)) |
232 args.Append(params_value->DeepCopy()); | 232 args.Append(params_value->DeepCopy()); |
233 | 233 |
234 std::string json_args; | 234 std::string json_args; |
235 base::JSONWriter::Write(&args, false, &json_args); | 235 base::JSONWriter::Write(&args, false, &json_args); |
236 | 236 |
237 profile->GetExtensionEventRouter()->DispatchEventToExtension( | 237 profile->GetExtensionEventRouter()->DispatchEventToExtension( |
238 extension_id_, keys::kOnEvent, json_args, profile, GURL()); | 238 extension_id_, keys::kOnEvent, json_args, profile, GURL()); |
239 } else { | 239 } else { |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 return; | 358 return; |
359 } | 359 } |
360 | 360 |
361 Value* result_body; | 361 Value* result_body; |
362 if (dictionary->Get("result", &result_body)) | 362 if (dictionary->Get("result", &result_body)) |
363 result_.reset(result_body->DeepCopy()); | 363 result_.reset(result_body->DeepCopy()); |
364 else | 364 else |
365 result_.reset(new DictionaryValue()); | 365 result_.reset(new DictionaryValue()); |
366 SendResponse(true); | 366 SendResponse(true); |
367 } | 367 } |
OLD | NEW |