Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(133)

Side by Side Diff: chrome/browser/chromeos/extensions/file_manager_util.cc

Issue 9960077: Modify the base::JSONReader interface to take a set of options rather than a boolean flag. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #include "chrome/browser/chromeos/extensions/file_manager_util.h" 4 #include "chrome/browser/chromeos/extensions/file_manager_util.h"
5 5
6 #include "base/bind.h" 6 #include "base/bind.h"
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/json/json_reader.h" 8 #include "base/json/json_reader.h"
9 #include "base/json/json_writer.h" 9 #include "base/json/json_writer.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 // in a tab. 520 // in a tab.
521 void ReadUrlFromGDocOnFileThread(const FilePath& file_path) { 521 void ReadUrlFromGDocOnFileThread(const FilePath& file_path) {
522 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 522 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
523 std::string contents; 523 std::string contents;
524 if (!ReadSmallFileToString(file_path, &contents)) { 524 if (!ReadSmallFileToString(file_path, &contents)) {
525 LOG(ERROR) << "Error reading " << file_path.value(); 525 LOG(ERROR) << "Error reading " << file_path.value();
526 return; 526 return;
527 } 527 }
528 528
529 scoped_ptr<base::Value> root_value; 529 scoped_ptr<base::Value> root_value;
530 root_value.reset( 530 root_value.reset(base::JSONReader::Read(contents));
531 base::JSONReader::Read(contents, false /* no trailing comma */));
532 531
533 DictionaryValue* dictionary_value; 532 DictionaryValue* dictionary_value;
534 std::string edit_url_string; 533 std::string edit_url_string;
535 if (!root_value.get() || 534 if (!root_value.get() ||
536 !root_value->GetAsDictionary(&dictionary_value) || 535 !root_value->GetAsDictionary(&dictionary_value) ||
537 !dictionary_value->GetString("url", &edit_url_string)) { 536 !dictionary_value->GetString("url", &edit_url_string)) {
538 LOG(ERROR) << "Invalid JSON in " << file_path.value(); 537 LOG(ERROR) << "Invalid JSON in " << file_path.value();
539 return; 538 return;
540 } 539 }
541 540
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
674 GDataOperationRegistry::ProgressStatus>::const_iterator iter = 673 GDataOperationRegistry::ProgressStatus>::const_iterator iter =
675 list.begin(); 674 list.begin();
676 iter != list.end(); ++iter) { 675 iter != list.end(); ++iter) {
677 result_list->Append( 676 result_list->Append(
678 ProgessStatusToDictionaryValue(profile, origin_url, *iter)); 677 ProgessStatusToDictionaryValue(profile, origin_url, *iter));
679 } 678 }
680 return result_list.release(); 679 return result_list.release();
681 } 680 }
682 681
683 } // namespace file_manager_util 682 } // namespace file_manager_util
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698