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

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

Issue 10873022: Revert 152904 - Moving FaviconService to a ProfileKeyedService. (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
« no previous file with comments | « no previous file | chrome/browser/bookmarks/bookmark_html_writer_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
11 #include "base/file_path.h" 11 #include "base/file_path.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/memory/ref_counted_memory.h" 13 #include "base/memory/ref_counted_memory.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "base/message_loop.h" 15 #include "base/message_loop.h"
16 #include "base/platform_file.h" 16 #include "base/platform_file.h"
17 #include "base/string_number_conversions.h" 17 #include "base/string_number_conversions.h"
18 #include "base/time.h" 18 #include "base/time.h"
19 #include "base/values.h" 19 #include "base/values.h"
20 #include "chrome/browser/bookmarks/bookmark_codec.h" 20 #include "chrome/browser/bookmarks/bookmark_codec.h"
21 #include "chrome/browser/bookmarks/bookmark_model.h" 21 #include "chrome/browser/bookmarks/bookmark_model.h"
22 #include "chrome/browser/bookmarks/bookmark_model_factory.h" 22 #include "chrome/browser/bookmarks/bookmark_model_factory.h"
23 #include "chrome/browser/favicon/favicon_service_factory.h"
24 #include "chrome/browser/history/history_types.h" 23 #include "chrome/browser/history/history_types.h"
25 #include "chrome/browser/profiles/profile.h" 24 #include "chrome/browser/profiles/profile.h"
26 #include "chrome/common/chrome_notification_types.h" 25 #include "chrome/common/chrome_notification_types.h"
27 #include "content/public/browser/browser_thread.h" 26 #include "content/public/browser/browser_thread.h"
28 #include "content/public/browser/notification_source.h" 27 #include "content/public/browser/notification_source.h"
29 #include "grit/generated_resources.h" 28 #include "grit/generated_resources.h"
30 #include "net/base/escape.h" 29 #include "net/base/escape.h"
31 #include "net/base/file_stream.h" 30 #include "net/base/file_stream.h"
32 #include "net/base/net_errors.h" 31 #include "net/base/net_errors.h"
33 #include "ui/base/l10n/l10n_util.h" 32 #include "ui/base/l10n/l10n_util.h"
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 450
452 bool BookmarkFaviconFetcher::FetchNextFavicon() { 451 bool BookmarkFaviconFetcher::FetchNextFavicon() {
453 if (bookmark_urls_.empty()) { 452 if (bookmark_urls_.empty()) {
454 return false; 453 return false;
455 } 454 }
456 do { 455 do {
457 std::string url = bookmark_urls_.front(); 456 std::string url = bookmark_urls_.front();
458 // Filter out urls that we've already got favicon for. 457 // Filter out urls that we've already got favicon for.
459 URLFaviconMap::const_iterator iter = favicons_map_->find(url); 458 URLFaviconMap::const_iterator iter = favicons_map_->find(url);
460 if (favicons_map_->end() == iter) { 459 if (favicons_map_->end() == iter) {
461 FaviconService* favicon_service = FaviconServiceFactory::GetForProfile( 460 FaviconService* favicon_service =
462 profile_, Profile::EXPLICIT_ACCESS); 461 profile_->GetFaviconService(Profile::EXPLICIT_ACCESS);
463 favicon_service->GetFaviconForURL(profile_, GURL(url), history::FAVICON, 462 favicon_service->GetFaviconForURL(GURL(url), history::FAVICON,
464 &favicon_consumer_, 463 &favicon_consumer_,
465 base::Bind(&BookmarkFaviconFetcher::OnFaviconDataAvailable, 464 base::Bind(&BookmarkFaviconFetcher::OnFaviconDataAvailable,
466 base::Unretained(this))); 465 base::Unretained(this)));
467 return true; 466 return true;
468 } else { 467 } else {
469 bookmark_urls_.pop_front(); 468 bookmark_urls_.pop_front();
470 } 469 }
471 } while (!bookmark_urls_.empty()); 470 } while (!bookmark_urls_.empty());
472 return false; 471 return false;
473 } 472 }
(...skipping 24 matching lines...) Expand all
498 // BookmarkModel isn't thread safe (nor would we want to lock it down 497 // BookmarkModel isn't thread safe (nor would we want to lock it down
499 // for the duration of the write), as such we make a copy of the 498 // for the duration of the write), as such we make a copy of the
500 // BookmarkModel using BookmarkCodec then write from that. 499 // BookmarkModel using BookmarkCodec then write from that.
501 if (fetcher == NULL) { 500 if (fetcher == NULL) {
502 fetcher = new BookmarkFaviconFetcher(profile, path, observer); 501 fetcher = new BookmarkFaviconFetcher(profile, path, observer);
503 fetcher->ExportBookmarks(); 502 fetcher->ExportBookmarks();
504 } 503 }
505 } 504 }
506 505
507 } // namespace bookmark_html_writer 506 } // namespace bookmark_html_writer
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/bookmarks/bookmark_html_writer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698