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

Side by Side Diff: chrome/browser/history/starred_url_database.cc

Issue 9590002: JSONWriter cleanup: integrate pretty print into write options. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix merge conflict 7. Created 8 years, 9 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
« no previous file with comments | « chrome/browser/history/history_extension_api.cc ('k') | chrome/browser/net/net_log_logger.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 4
5 #include "chrome/browser/history/starred_url_database.h" 5 #include "chrome/browser/history/starred_url_database.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/json/json_writer.h" 8 #include "base/json/json_writer.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/scoped_vector.h" 10 #include "base/memory/scoped_vector.h"
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 // visual order so that we know we maintain visual order by always adding 643 // visual order so that we know we maintain visual order by always adding
644 // to the end. 644 // to the end.
645 parent->Add(node, parent->child_count()); 645 parent->Add(node, parent->child_count());
646 } 646 }
647 647
648 // Save to file. 648 // Save to file.
649 BookmarkCodec encoder; 649 BookmarkCodec encoder;
650 scoped_ptr<Value> encoded_bookmarks( 650 scoped_ptr<Value> encoded_bookmarks(
651 encoder.Encode(&bookmark_bar_node, &other_node, &mobile_node)); 651 encoder.Encode(&bookmark_bar_node, &other_node, &mobile_node));
652 std::string content; 652 std::string content;
653 base::JSONWriter::Write(encoded_bookmarks.get(), true, &content); 653 base::JSONWriter::WriteWithOptions(encoded_bookmarks.get(),
654 base::JSONWriter::OPTIONS_PRETTY_PRINT,
655 &content);
654 656
655 return (file_util::WriteFile(path, content.c_str(), 657 return (file_util::WriteFile(path, content.c_str(),
656 static_cast<int>(content.length())) != -1); 658 static_cast<int>(content.length())) != -1);
657 } 659 }
658 660
659 } // namespace history 661 } // namespace history
OLDNEW
« no previous file with comments | « chrome/browser/history/history_extension_api.cc ('k') | chrome/browser/net/net_log_logger.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698