| 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/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 Loading... |
| 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 |
| OLD | NEW |