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