Chromium Code Reviews| 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/bookmarks/bookmark_html_writer.h" | 5 #include "chrome/browser/bookmarks/bookmark_html_writer.h" |
| 6 | 6 |
| 7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/platform_file.h" | 10 #include "base/platform_file.h" |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 187 | 187 |
| 188 // Indents the current line. | 188 // Indents the current line. |
| 189 bool WriteIndent() { | 189 bool WriteIndent() { |
| 190 return Write(indent_); | 190 return Write(indent_); |
| 191 } | 191 } |
| 192 | 192 |
| 193 // Converts a time string written to the JSON codec into a time_t string | 193 // Converts a time string written to the JSON codec into a time_t string |
| 194 // (used by bookmarks.html) and writes it. | 194 // (used by bookmarks.html) and writes it. |
| 195 bool WriteTime(const std::wstring& time_string) { | 195 bool WriteTime(const std::wstring& time_string) { |
| 196 base::Time time = | 196 base::Time time = |
| 197 base::Time::FromInternalValue(StringToInt64(time_string)); | 197 base::Time::FromInternalValue(StringToInt64(WideToUTF16Hack( |
|
brettw
2009/02/27 23:45:15
See prev comment.
| |
| 198 time_string))); | |
| 198 return Write(Int64ToString(time.ToTimeT())); | 199 return Write(Int64ToString(time.ToTimeT())); |
| 199 } | 200 } |
| 200 | 201 |
| 201 // Writes the node and all its children, returning true on success. | 202 // Writes the node and all its children, returning true on success. |
| 202 bool WriteNode(const DictionaryValue& value, | 203 bool WriteNode(const DictionaryValue& value, |
| 203 history::StarredEntry::Type folder_type) { | 204 history::StarredEntry::Type folder_type) { |
| 204 std::wstring title, date_added_string, type_string; | 205 std::wstring title, date_added_string, type_string; |
| 205 if (!value.GetString(BookmarkCodec::kNameKey, &title) || | 206 if (!value.GetString(BookmarkCodec::kNameKey, &title) || |
| 206 !value.GetString(BookmarkCodec::kDateAddedKey, &date_added_string) || | 207 !value.GetString(BookmarkCodec::kDateAddedKey, &date_added_string) || |
| 207 !value.GetString(BookmarkCodec::kTypeKey, &type_string) || | 208 !value.GetString(BookmarkCodec::kTypeKey, &type_string) || |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 322 BookmarkCodec codec; | 323 BookmarkCodec codec; |
| 323 scoped_ptr<Writer> writer(new Writer(codec.Encode(model), | 324 scoped_ptr<Writer> writer(new Writer(codec.Encode(model), |
| 324 FilePath::FromWStringHack(path))); | 325 FilePath::FromWStringHack(path))); |
| 325 if (thread) | 326 if (thread) |
| 326 thread->PostTask(FROM_HERE, writer.release()); | 327 thread->PostTask(FROM_HERE, writer.release()); |
| 327 else | 328 else |
| 328 writer->Run(); | 329 writer->Run(); |
| 329 } | 330 } |
| 330 | 331 |
| 331 } // namespace bookmark_html_writer | 332 } // namespace bookmark_html_writer |
| OLD | NEW |