| 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 #include "chrome/browser/history/starred_url_database.h" | 5 #include "chrome/browser/history/starred_url_database.h" |
| 6 | 6 |
| 7 #include "app/sql/statement.h" | |
| 8 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 9 #include "base/json/json_writer.h" | 8 #include "base/json/json_writer.h" |
| 10 #include "base/logging.h" | 9 #include "base/logging.h" |
| 11 #include "base/memory/scoped_vector.h" | 10 #include "base/memory/scoped_vector.h" |
| 12 #include "base/stl_util-inl.h" | 11 #include "base/stl_util-inl.h" |
| 13 #include "base/string_util.h" | 12 #include "base/string_util.h" |
| 14 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
| 15 #include "base/values.h" | 14 #include "base/values.h" |
| 16 #include "chrome/browser/bookmarks/bookmark_codec.h" | 15 #include "chrome/browser/bookmarks/bookmark_codec.h" |
| 17 #include "chrome/browser/bookmarks/bookmark_model.h" | 16 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 18 #include "chrome/browser/history/history.h" | 17 #include "chrome/browser/history/history.h" |
| 18 #include "sql/statement.h" |
| 19 | 19 |
| 20 // The following table is used to store star (aka bookmark) information. This | 20 // The following table is used to store star (aka bookmark) information. This |
| 21 // class derives from URLDatabase, which has its own schema. | 21 // class derives from URLDatabase, which has its own schema. |
| 22 // | 22 // |
| 23 // starred | 23 // starred |
| 24 // id Unique identifier (primary key) for the entry. | 24 // id Unique identifier (primary key) for the entry. |
| 25 // type Type of entry, if 0 this corresponds to a URL, 1 for | 25 // type Type of entry, if 0 this corresponds to a URL, 1 for |
| 26 // a system folder, 2 for a user created folder, 3 for | 26 // a system folder, 2 for a user created folder, 3 for |
| 27 // other. Note that 4 (synced) will never appear in the | 27 // other. Note that 4 (synced) will never appear in the |
| 28 // database because it was added after this storage was | 28 // database because it was added after this storage was |
| (...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 661 scoped_ptr<Value> encoded_bookmarks( | 661 scoped_ptr<Value> encoded_bookmarks( |
| 662 encoder.Encode(&bookmark_bar_node, &other_node, &synced_node)); | 662 encoder.Encode(&bookmark_bar_node, &other_node, &synced_node)); |
| 663 std::string content; | 663 std::string content; |
| 664 base::JSONWriter::Write(encoded_bookmarks.get(), true, &content); | 664 base::JSONWriter::Write(encoded_bookmarks.get(), true, &content); |
| 665 | 665 |
| 666 return (file_util::WriteFile(path, content.c_str(), | 666 return (file_util::WriteFile(path, content.c_str(), |
| 667 static_cast<int>(content.length())) != -1); | 667 static_cast<int>(content.length())) != -1); |
| 668 } | 668 } |
| 669 | 669 |
| 670 } // namespace history | 670 } // namespace history |
| OLD | NEW |