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

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

Issue 6651014: Applied the IconType. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 9 years, 9 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) 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
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(
443 GURL(url),
sky 2011/03/09 21:41:08 Generally folks put as many args on a line as will
michaelbai 2011/03/09 23:11:45 Done.
444 history::FAV_ICON,
445 &fav_icon_consumer_,
443 NewCallback(this, &BookmarkFaviconFetcher::OnFavIconDataAvailable)); 446 NewCallback(this, &BookmarkFaviconFetcher::OnFavIconDataAvailable));
444 return true; 447 return true;
445 } else { 448 } else {
446 bookmark_urls_.pop_front(); 449 bookmark_urls_.pop_front();
447 } 450 }
448 } while (!bookmark_urls_.empty()); 451 } while (!bookmark_urls_.empty());
449 return false; 452 return false;
450 } 453 }
451 454
452 void BookmarkFaviconFetcher::OnFavIconDataAvailable( 455 void BookmarkFaviconFetcher::OnFavIconDataAvailable(
453 FaviconService::Handle handle, 456 FaviconService::Handle handle,
454 bool know_favicon, 457 bool know_favicon,
455 scoped_refptr<RefCountedMemory> data, 458 scoped_refptr<RefCountedMemory> data,
456 bool expired, 459 bool expired,
457 GURL icon_url) { 460 GURL icon_url,
461 history::IconType) {
sky 2011/03/09 21:41:08 From the style guide: 'All parameters should be na
michaelbai 2011/03/09 23:11:45 Done.
458 GURL url; 462 GURL url;
459 if (!bookmark_urls_.empty()) { 463 if (!bookmark_urls_.empty()) {
460 url = GURL(bookmark_urls_.front()); 464 url = GURL(bookmark_urls_.front());
461 bookmark_urls_.pop_front(); 465 bookmark_urls_.pop_front();
462 } 466 }
463 if (know_favicon && data.get() && data->size() && !url.is_empty()) { 467 if (know_favicon && data.get() && data->size() && !url.is_empty()) {
464 favicons_map_->insert(make_pair(url.spec(), data)); 468 favicons_map_->insert(make_pair(url.spec(), data));
465 } 469 }
466 470
467 if (FetchNextFavicon()) { 471 if (FetchNextFavicon()) {
(...skipping 10 matching lines...) Expand all
478 // BookmarkModel isn't thread safe (nor would we want to lock it down 482 // 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 483 // for the duration of the write), as such we make a copy of the
480 // BookmarkModel using BookmarkCodec then write from that. 484 // BookmarkModel using BookmarkCodec then write from that.
481 if (fetcher == NULL) { 485 if (fetcher == NULL) {
482 fetcher = new BookmarkFaviconFetcher(profile, path, observer); 486 fetcher = new BookmarkFaviconFetcher(profile, path, observer);
483 fetcher->ExportBookmarks(); 487 fetcher->ExportBookmarks();
484 } 488 }
485 } 489 }
486 490
487 } // namespace bookmark_html_writer 491 } // namespace bookmark_html_writer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698