Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(798)

Side by Side Diff: chrome/browser/bookmarks/bookmark_html_writer.cc

Issue 10870022: Change FaviconData to be able to return data for multiple bitmaps for same icon URL (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 return true; 466 return true;
467 } else { 467 } else {
468 bookmark_urls_.pop_front(); 468 bookmark_urls_.pop_front();
469 } 469 }
470 } while (!bookmark_urls_.empty()); 470 } while (!bookmark_urls_.empty());
471 return false; 471 return false;
472 } 472 }
473 473
474 void BookmarkFaviconFetcher::OnFaviconDataAvailable( 474 void BookmarkFaviconFetcher::OnFaviconDataAvailable(
475 FaviconService::Handle handle, 475 FaviconService::Handle handle,
476 history::FaviconData favicon) { 476 history::FaviconData favicon_data,
477 std::vector<GURL> icon_urls_in_db) {
477 GURL url; 478 GURL url;
478 if (!bookmark_urls_.empty()) { 479 if (!bookmark_urls_.empty()) {
479 url = GURL(bookmark_urls_.front()); 480 url = GURL(bookmark_urls_.front());
480 bookmark_urls_.pop_front(); 481 bookmark_urls_.pop_front();
481 } 482 }
482 if (favicon.is_valid() && !url.is_empty()) { 483 if (favicon_data.has_valid_bitmaps() && !url.is_empty()) {
483 favicons_map_->insert(make_pair(url.spec(), favicon.image_data)); 484 favicons_map_->insert(
485 make_pair(url.spec(), favicon_data.first_bitmap()));
484 } 486 }
485 487
486 if (FetchNextFavicon()) { 488 if (FetchNextFavicon()) {
487 return; 489 return;
488 } 490 }
489 ExecuteWriter(); 491 ExecuteWriter();
490 } 492 }
491 493
492 namespace bookmark_html_writer { 494 namespace bookmark_html_writer {
493 495
494 void WriteBookmarks(Profile* profile, 496 void WriteBookmarks(Profile* profile,
495 const FilePath& path, 497 const FilePath& path,
496 BookmarksExportObserver* observer) { 498 BookmarksExportObserver* observer) {
497 // 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
498 // 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
499 // BookmarkModel using BookmarkCodec then write from that. 501 // BookmarkModel using BookmarkCodec then write from that.
500 if (fetcher == NULL) { 502 if (fetcher == NULL) {
501 fetcher = new BookmarkFaviconFetcher(profile, path, observer); 503 fetcher = new BookmarkFaviconFetcher(profile, path, observer);
502 fetcher->ExportBookmarks(); 504 fetcher->ExportBookmarks();
503 } 505 }
504 } 506 }
505 507
506 } // namespace bookmark_html_writer 508 } // namespace bookmark_html_writer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698