| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 if (bookmark_urls_.empty()) { | 432 if (bookmark_urls_.empty()) { |
| 433 return false; | 433 return false; |
| 434 } | 434 } |
| 435 do { | 435 do { |
| 436 std::string url = bookmark_urls_.front(); | 436 std::string url = bookmark_urls_.front(); |
| 437 // Filter out urls that we've already got favicon for. | 437 // Filter out urls that we've already got favicon for. |
| 438 URLFaviconMap::const_iterator iter = favicons_map_->find(url); | 438 URLFaviconMap::const_iterator iter = favicons_map_->find(url); |
| 439 if (favicons_map_->end() == iter) { | 439 if (favicons_map_->end() == iter) { |
| 440 FaviconService* favicon_service = | 440 FaviconService* favicon_service = |
| 441 profile_->GetFaviconService(Profile::EXPLICIT_ACCESS); | 441 profile_->GetFaviconService(Profile::EXPLICIT_ACCESS); |
| 442 favicon_service->GetFaviconForURL(GURL(url), &fav_icon_consumer_, | 442 favicon_service->GetFaviconForURL(GURL(url), &favicon_consumer_, |
| 443 NewCallback(this, &BookmarkFaviconFetcher::OnFavIconDataAvailable)); | 443 NewCallback(this, &BookmarkFaviconFetcher::OnFavIconDataAvailable)); |
| 444 return true; | 444 return true; |
| 445 } else { | 445 } else { |
| 446 bookmark_urls_.pop_front(); | 446 bookmark_urls_.pop_front(); |
| 447 } | 447 } |
| 448 } while (!bookmark_urls_.empty()); | 448 } while (!bookmark_urls_.empty()); |
| 449 return false; | 449 return false; |
| 450 } | 450 } |
| 451 | 451 |
| 452 void BookmarkFaviconFetcher::OnFavIconDataAvailable( | 452 void BookmarkFaviconFetcher::OnFavIconDataAvailable( |
| (...skipping 25 matching lines...) Expand all Loading... |
| 478 // BookmarkModel isn't thread safe (nor would we want to lock it down | 478 // BookmarkModel isn't thread safe (nor would we want to lock it down |
| 479 // for the duration of the write), as such we make a copy of the | 479 // for the duration of the write), as such we make a copy of the |
| 480 // BookmarkModel using BookmarkCodec then write from that. | 480 // BookmarkModel using BookmarkCodec then write from that. |
| 481 if (fetcher == NULL) { | 481 if (fetcher == NULL) { |
| 482 fetcher = new BookmarkFaviconFetcher(profile, path, observer); | 482 fetcher = new BookmarkFaviconFetcher(profile, path, observer); |
| 483 fetcher->ExportBookmarks(); | 483 fetcher->ExportBookmarks(); |
| 484 } | 484 } |
| 485 } | 485 } |
| 486 | 486 |
| 487 } // namespace bookmark_html_writer | 487 } // namespace bookmark_html_writer |
| OLD | NEW |