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 "base/base64.h" | 7 #include "base/base64.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 !Write(kFolderChildren) || | 327 !Write(kFolderChildren) || |
328 !Write(kNewline)) { | 328 !Write(kNewline)) { |
329 return false; | 329 return false; |
330 } | 330 } |
331 IncrementIndent(); | 331 IncrementIndent(); |
332 } | 332 } |
333 | 333 |
334 // Write the children. | 334 // Write the children. |
335 const ListValue* children = static_cast<const ListValue*>(child_values); | 335 const ListValue* children = static_cast<const ListValue*>(child_values); |
336 for (size_t i = 0; i < children->GetSize(); ++i) { | 336 for (size_t i = 0; i < children->GetSize(); ++i) { |
337 Value* child_value; | 337 const Value* child_value; |
338 if (!children->Get(i, &child_value) || | 338 if (!children->Get(i, &child_value) || |
339 child_value->GetType() != Value::TYPE_DICTIONARY) { | 339 child_value->GetType() != Value::TYPE_DICTIONARY) { |
340 NOTREACHED(); | 340 NOTREACHED(); |
341 return false; | 341 return false; |
342 } | 342 } |
343 if (!WriteNode(*static_cast<const DictionaryValue*>(child_value), | 343 if (!WriteNode(*static_cast<const DictionaryValue*>(child_value), |
344 BookmarkNode::FOLDER)) { | 344 BookmarkNode::FOLDER)) { |
345 return false; | 345 return false; |
346 } | 346 } |
347 } | 347 } |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
497 // BookmarkModel isn't thread safe (nor would we want to lock it down | 497 // BookmarkModel isn't thread safe (nor would we want to lock it down |
498 // for the duration of the write), as such we make a copy of the | 498 // for the duration of the write), as such we make a copy of the |
499 // BookmarkModel using BookmarkCodec then write from that. | 499 // BookmarkModel using BookmarkCodec then write from that. |
500 if (fetcher == NULL) { | 500 if (fetcher == NULL) { |
501 fetcher = new BookmarkFaviconFetcher(profile, path, observer); | 501 fetcher = new BookmarkFaviconFetcher(profile, path, observer); |
502 fetcher->ExportBookmarks(); | 502 fetcher->ExportBookmarks(); |
503 } | 503 } |
504 } | 504 } |
505 | 505 |
506 } // namespace bookmark_html_writer | 506 } // namespace bookmark_html_writer |
OLD | NEW |