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/utility/chrome_content_utility_client.h" | 5 #include "chrome/utility/chrome_content_utility_client.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/base64.h" | 8 #include "base/base64.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 } | 350 } |
351 metafile.FinishDocument(); | 351 metafile.FinishDocument(); |
352 return ret; | 352 return ret; |
353 } | 353 } |
354 #endif // defined(OS_WIN) | 354 #endif // defined(OS_WIN) |
355 | 355 |
356 | 356 |
357 void ChromeContentUtilityClient::OnParseJSON(const std::string& json) { | 357 void ChromeContentUtilityClient::OnParseJSON(const std::string& json) { |
358 int error_code; | 358 int error_code; |
359 std::string error; | 359 std::string error; |
360 Value* value = | 360 Value* value = base::JSONReader::ReadAndReturnError( |
361 base::JSONReader::ReadAndReturnError(json, false, &error_code, &error); | 361 json, base::JSON_PARSE_RFC, &error_code, &error); |
362 if (value) { | 362 if (value) { |
363 ListValue wrapper; | 363 ListValue wrapper; |
364 wrapper.Append(value); | 364 wrapper.Append(value); |
365 Send(new ChromeUtilityHostMsg_ParseJSON_Succeeded(wrapper)); | 365 Send(new ChromeUtilityHostMsg_ParseJSON_Succeeded(wrapper)); |
366 } else { | 366 } else { |
367 Send(new ChromeUtilityHostMsg_ParseJSON_Failed(error)); | 367 Send(new ChromeUtilityHostMsg_ParseJSON_Failed(error)); |
368 } | 368 } |
369 content::UtilityThread::Get()->ReleaseProcessIfNeeded(); | 369 content::UtilityThread::Get()->ReleaseProcessIfNeeded(); |
370 } | 370 } |
371 | 371 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
432 | 432 |
433 void ChromeContentUtilityClient::ImporterCleanup() { | 433 void ChromeContentUtilityClient::ImporterCleanup() { |
434 importer_->Cancel(); | 434 importer_->Cancel(); |
435 importer_ = NULL; | 435 importer_ = NULL; |
436 bridge_ = NULL; | 436 bridge_ = NULL; |
437 import_thread_.reset(); | 437 import_thread_.reset(); |
438 content::UtilityThread::Get()->ReleaseProcessIfNeeded(); | 438 content::UtilityThread::Get()->ReleaseProcessIfNeeded(); |
439 } | 439 } |
440 | 440 |
441 } // namespace chrome | 441 } // namespace chrome |
OLD | NEW |