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/bookmarks/bookmark_html_writer.h" | 5 #include "chrome/browser/bookmarks/bookmark_html_writer.h" |
6 | 6 |
| 7 #include <stddef.h> |
| 8 #include <stdint.h> |
| 9 |
7 #include "base/base64.h" | 10 #include "base/base64.h" |
8 #include "base/bind.h" | 11 #include "base/bind.h" |
9 #include "base/bind_helpers.h" | 12 #include "base/bind_helpers.h" |
10 #include "base/callback.h" | 13 #include "base/callback.h" |
11 #include "base/files/file.h" | 14 #include "base/files/file.h" |
| 15 #include "base/macros.h" |
12 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
13 #include "base/message_loop/message_loop.h" | 17 #include "base/message_loop/message_loop.h" |
14 #include "base/strings/string_number_conversions.h" | 18 #include "base/strings/string_number_conversions.h" |
15 #include "base/strings/string_util.h" | 19 #include "base/strings/string_util.h" |
16 #include "base/time/time.h" | 20 #include "base/time/time.h" |
17 #include "base/values.h" | 21 #include "base/values.h" |
18 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 22 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
19 #include "chrome/browser/chrome_notification_types.h" | 23 #include "chrome/browser/chrome_notification_types.h" |
20 #include "chrome/browser/favicon/favicon_service_factory.h" | 24 #include "chrome/browser/favicon/favicon_service_factory.h" |
21 #include "components/bookmarks/browser/bookmark_codec.h" | 25 #include "components/bookmarks/browser/bookmark_codec.h" |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 } | 233 } |
230 | 234 |
231 // Indents the current line. | 235 // Indents the current line. |
232 bool WriteIndent() { | 236 bool WriteIndent() { |
233 return Write(indent_); | 237 return Write(indent_); |
234 } | 238 } |
235 | 239 |
236 // Converts a time string written to the JSON codec into a time_t string | 240 // Converts a time string written to the JSON codec into a time_t string |
237 // (used by bookmarks.html) and writes it. | 241 // (used by bookmarks.html) and writes it. |
238 bool WriteTime(const std::string& time_string) { | 242 bool WriteTime(const std::string& time_string) { |
239 int64 internal_value; | 243 int64_t internal_value; |
240 base::StringToInt64(time_string, &internal_value); | 244 base::StringToInt64(time_string, &internal_value); |
241 return Write(base::Int64ToString( | 245 return Write(base::Int64ToString( |
242 base::Time::FromInternalValue(internal_value).ToTimeT())); | 246 base::Time::FromInternalValue(internal_value).ToTimeT())); |
243 } | 247 } |
244 | 248 |
245 // Writes the node and all its children, returning true on success. | 249 // Writes the node and all its children, returning true on success. |
246 bool WriteNode(const base::DictionaryValue& value, | 250 bool WriteNode(const base::DictionaryValue& value, |
247 BookmarkNode::Type folder_type) { | 251 BookmarkNode::Type folder_type) { |
248 std::string title, date_added_string, type_string; | 252 std::string title, date_added_string, type_string; |
249 if (!value.GetString(BookmarkCodec::kNameKey, &title) || | 253 if (!value.GetString(BookmarkCodec::kNameKey, &title) || |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
502 // BookmarkModel isn't thread safe (nor would we want to lock it down | 506 // BookmarkModel isn't thread safe (nor would we want to lock it down |
503 // for the duration of the write), as such we make a copy of the | 507 // for the duration of the write), as such we make a copy of the |
504 // BookmarkModel using BookmarkCodec then write from that. | 508 // BookmarkModel using BookmarkCodec then write from that. |
505 if (fetcher == NULL) { | 509 if (fetcher == NULL) { |
506 fetcher = new BookmarkFaviconFetcher(profile, path, observer); | 510 fetcher = new BookmarkFaviconFetcher(profile, path, observer); |
507 fetcher->ExportBookmarks(); | 511 fetcher->ExportBookmarks(); |
508 } | 512 } |
509 } | 513 } |
510 | 514 |
511 } // namespace bookmark_html_writer | 515 } // namespace bookmark_html_writer |
OLD | NEW |