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 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 | 470 |
471 void BookmarkFaviconFetcher::OnFaviconDataAvailable( | 471 void BookmarkFaviconFetcher::OnFaviconDataAvailable( |
472 FaviconService::Handle handle, | 472 FaviconService::Handle handle, |
473 history::FaviconData favicon) { | 473 history::FaviconData favicon) { |
474 GURL url; | 474 GURL url; |
475 if (!bookmark_urls_.empty()) { | 475 if (!bookmark_urls_.empty()) { |
476 url = GURL(bookmark_urls_.front()); | 476 url = GURL(bookmark_urls_.front()); |
477 bookmark_urls_.pop_front(); | 477 bookmark_urls_.pop_front(); |
478 } | 478 } |
479 if (favicon.is_valid() && !url.is_empty()) { | 479 if (favicon.is_valid() && !url.is_empty()) { |
480 favicons_map_->insert(make_pair(url.spec(), favicon.bitmap_data)); | 480 //favicons_map_->insert(make_pair(url.spec(), favicon.bitmap_data)); |
481 } | 481 } |
482 | 482 |
483 if (FetchNextFavicon()) { | 483 if (FetchNextFavicon()) { |
484 return; | 484 return; |
485 } | 485 } |
486 ExecuteWriter(); | 486 ExecuteWriter(); |
487 } | 487 } |
488 | 488 |
489 namespace bookmark_html_writer { | 489 namespace bookmark_html_writer { |
490 | 490 |
491 void WriteBookmarks(Profile* profile, | 491 void WriteBookmarks(Profile* profile, |
492 const FilePath& path, | 492 const FilePath& path, |
493 BookmarksExportObserver* observer) { | 493 BookmarksExportObserver* observer) { |
494 // BookmarkModel isn't thread safe (nor would we want to lock it down | 494 // BookmarkModel isn't thread safe (nor would we want to lock it down |
495 // for the duration of the write), as such we make a copy of the | 495 // for the duration of the write), as such we make a copy of the |
496 // BookmarkModel using BookmarkCodec then write from that. | 496 // BookmarkModel using BookmarkCodec then write from that. |
497 if (fetcher == NULL) { | 497 if (fetcher == NULL) { |
498 fetcher = new BookmarkFaviconFetcher(profile, path, observer); | 498 fetcher = new BookmarkFaviconFetcher(profile, path, observer); |
499 fetcher->ExportBookmarks(); | 499 fetcher->ExportBookmarks(); |
500 } | 500 } |
501 } | 501 } |
502 | 502 |
503 } // namespace bookmark_html_writer | 503 } // namespace bookmark_html_writer |
OLD | NEW |