| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/json_writer.h" | 9 #include "base/json_writer.h" |
| 10 #include "base/scoped_vector.h" |
| 11 #include "base/stl_util-inl.h" |
| 10 #include "base/string_util.h" | 12 #include "base/string_util.h" |
| 11 #include "base/values.h" | 13 #include "base/values.h" |
| 12 #include "chrome/browser/bookmarks/bookmark_codec.h" | 14 #include "chrome/browser/bookmarks/bookmark_codec.h" |
| 13 #include "chrome/browser/bookmarks/bookmark_model.h" | 15 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 14 #include "chrome/browser/history/history.h" | 16 #include "chrome/browser/history/history.h" |
| 15 #include "chrome/browser/history/query_parser.h" | 17 #include "chrome/browser/history/query_parser.h" |
| 16 #include "chrome/browser/meta_table_helper.h" | 18 #include "chrome/browser/meta_table_helper.h" |
| 17 #include "chrome/common/scoped_vector.h" | |
| 18 #include "chrome/common/sqlite_compiled_statement.h" | 19 #include "chrome/common/sqlite_compiled_statement.h" |
| 19 #include "chrome/common/sqlite_utils.h" | 20 #include "chrome/common/sqlite_utils.h" |
| 20 #include "chrome/common/stl_util-inl.h" | |
| 21 | 21 |
| 22 using base::Time; | 22 using base::Time; |
| 23 | 23 |
| 24 // The following table is used to store star (aka bookmark) information. This | 24 // The following table is used to store star (aka bookmark) information. This |
| 25 // class derives from URLDatabase, which has its own schema. | 25 // class derives from URLDatabase, which has its own schema. |
| 26 // | 26 // |
| 27 // starred | 27 // starred |
| 28 // id Unique identifier (primary key) for the entry. | 28 // id Unique identifier (primary key) for the entry. |
| 29 // type Type of entry, if 0 this corresponds to a URL, 1 for | 29 // type Type of entry, if 0 this corresponds to a URL, 1 for |
| 30 // a system grouping, 2 for a user created group, 3 for | 30 // a system grouping, 2 for a user created group, 3 for |
| (...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 623 scoped_ptr<Value> encoded_bookmarks( | 623 scoped_ptr<Value> encoded_bookmarks( |
| 624 encoder.Encode(&bookmark_bar_node, &other_node)); | 624 encoder.Encode(&bookmark_bar_node, &other_node)); |
| 625 std::string content; | 625 std::string content; |
| 626 JSONWriter::Write(encoded_bookmarks.get(), true, &content); | 626 JSONWriter::Write(encoded_bookmarks.get(), true, &content); |
| 627 | 627 |
| 628 return (file_util::WriteFile(path, content.c_str(), | 628 return (file_util::WriteFile(path, content.c_str(), |
| 629 static_cast<int>(content.length())) != -1); | 629 static_cast<int>(content.length())) != -1); |
| 630 } | 630 } |
| 631 | 631 |
| 632 } // namespace history | 632 } // namespace history |
| OLD | NEW |