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