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 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
451 bool BookmarkFaviconFetcher::FetchNextFavicon() { | 451 bool BookmarkFaviconFetcher::FetchNextFavicon() { |
452 if (bookmark_urls_.empty()) { | 452 if (bookmark_urls_.empty()) { |
453 return false; | 453 return false; |
454 } | 454 } |
455 do { | 455 do { |
456 std::string url = bookmark_urls_.front(); | 456 std::string url = bookmark_urls_.front(); |
457 // Filter out urls that we've already got favicon for. | 457 // Filter out urls that we've already got favicon for. |
458 URLFaviconMap::const_iterator iter = favicons_map_->find(url); | 458 URLFaviconMap::const_iterator iter = favicons_map_->find(url); |
459 if (favicons_map_->end() == iter) { | 459 if (favicons_map_->end() == iter) { |
460 FaviconService* favicon_service = FaviconServiceFactory::GetForProfile( | 460 FaviconService* favicon_service = FaviconServiceFactory::GetForProfile( |
461 profile_, Profile::EXPLICIT_ACCESS); | 461 profile_, ServiceAccessType::EXPLICIT_ACCESS); |
462 favicon_service->GetRawFaviconForPageURL( | 462 favicon_service->GetRawFaviconForPageURL( |
463 GURL(url), | 463 GURL(url), |
464 favicon_base::FAVICON, | 464 favicon_base::FAVICON, |
465 gfx::kFaviconSize, | 465 gfx::kFaviconSize, |
466 base::Bind(&BookmarkFaviconFetcher::OnFaviconDataAvailable, | 466 base::Bind(&BookmarkFaviconFetcher::OnFaviconDataAvailable, |
467 base::Unretained(this)), | 467 base::Unretained(this)), |
468 &cancelable_task_tracker_); | 468 &cancelable_task_tracker_); |
469 return true; | 469 return true; |
470 } else { | 470 } else { |
471 bookmark_urls_.pop_front(); | 471 bookmark_urls_.pop_front(); |
(...skipping 28 matching lines...) Expand all Loading... |
500 // BookmarkModel isn't thread safe (nor would we want to lock it down | 500 // BookmarkModel isn't thread safe (nor would we want to lock it down |
501 // for the duration of the write), as such we make a copy of the | 501 // for the duration of the write), as such we make a copy of the |
502 // BookmarkModel using BookmarkCodec then write from that. | 502 // BookmarkModel using BookmarkCodec then write from that. |
503 if (fetcher == NULL) { | 503 if (fetcher == NULL) { |
504 fetcher = new BookmarkFaviconFetcher(profile, path, observer); | 504 fetcher = new BookmarkFaviconFetcher(profile, path, observer); |
505 fetcher->ExportBookmarks(); | 505 fetcher->ExportBookmarks(); |
506 } | 506 } |
507 } | 507 } |
508 | 508 |
509 } // namespace bookmark_html_writer | 509 } // namespace bookmark_html_writer |
OLD | NEW |