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

Side by Side Diff: chrome/browser/importer/profile_writer.cc

Issue 375613002: Bypass the favicon_service when importing favicons. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed friend. Created 6 years, 5 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
« no previous file with comments | « chrome/browser/history/history_service.cc ('k') | no next file » | 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/importer/profile_writer.h" 5 #include "chrome/browser/importer/profile_writer.h"
6 6
7 #include <map> 7 #include <map>
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 10
11 #include "base/prefs/pref_service.h" 11 #include "base/prefs/pref_service.h"
12 #include "base/strings/string_number_conversions.h" 12 #include "base/strings/string_number_conversions.h"
13 #include "base/strings/stringprintf.h" 13 #include "base/strings/stringprintf.h"
14 #include "base/strings/utf_string_conversions.h" 14 #include "base/strings/utf_string_conversions.h"
15 #include "base/threading/thread.h" 15 #include "base/threading/thread.h"
16 #include "chrome/browser/bookmarks/bookmark_model_factory.h" 16 #include "chrome/browser/bookmarks/bookmark_model_factory.h"
17 #include "chrome/browser/chrome_notification_types.h" 17 #include "chrome/browser/chrome_notification_types.h"
18 #include "chrome/browser/favicon/favicon_service.h" 18 #include "chrome/browser/favicon/favicon_service.h"
19 #include "chrome/browser/favicon/favicon_service_factory.h" 19 #include "chrome/browser/favicon/favicon_service_factory.h"
gab 2014/07/18 13:47:32 rm the above 2 includes
20 #include "chrome/browser/history/history_service.h" 20 #include "chrome/browser/history/history_service.h"
21 #include "chrome/browser/history/history_service_factory.h" 21 #include "chrome/browser/history/history_service_factory.h"
22 #include "chrome/browser/password_manager/password_store_factory.h" 22 #include "chrome/browser/password_manager/password_store_factory.h"
23 #include "chrome/browser/profiles/profile.h" 23 #include "chrome/browser/profiles/profile.h"
24 #include "chrome/browser/search_engines/template_url_service_factory.h" 24 #include "chrome/browser/search_engines/template_url_service_factory.h"
25 #include "chrome/browser/webdata/web_data_service.h" 25 #include "chrome/browser/webdata/web_data_service.h"
26 #include "chrome/common/importer/imported_bookmark_entry.h" 26 #include "chrome/common/importer/imported_bookmark_entry.h"
27 #include "chrome/common/importer/imported_favicon_usage.h" 27 #include "chrome/common/importer/imported_favicon_usage.h"
28 #include "chrome/common/pref_names.h" 28 #include "chrome/common/pref_names.h"
29 #include "components/bookmarks/browser/bookmark_model.h" 29 #include "components/bookmarks/browser/bookmark_model.h"
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 219
220 model->EndExtensiveChanges(); 220 model->EndExtensiveChanges();
221 221
222 // If the user was previously using a toolbar, we should show the bar. 222 // If the user was previously using a toolbar, we should show the bar.
223 if (import_to_top_level && !add_all_to_top_level) 223 if (import_to_top_level && !add_all_to_top_level)
224 ShowBookmarkBar(profile_); 224 ShowBookmarkBar(profile_);
225 } 225 }
226 226
227 void ProfileWriter::AddFavicons( 227 void ProfileWriter::AddFavicons(
228 const std::vector<ImportedFaviconUsage>& favicons) { 228 const std::vector<ImportedFaviconUsage>& favicons) {
229 FaviconServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS)-> 229 HistoryService* history_service =
230 SetImportedFavicons(favicons); 230 HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS);
231 if (history_service)
232 history_service->SetImportedFavicons(favicons);
231 } 233 }
232 234
233 typedef std::map<std::string, TemplateURL*> HostPathMap; 235 typedef std::map<std::string, TemplateURL*> HostPathMap;
234 236
235 // Returns the key for the map built by BuildHostPathMap. If url_string is not 237 // Returns the key for the map built by BuildHostPathMap. If url_string is not
236 // a valid URL, an empty string is returned, otherwise host+path is returned. 238 // a valid URL, an empty string is returned, otherwise host+path is returned.
237 static std::string HostPathKeyForURL(const GURL& url) { 239 static std::string HostPathKeyForURL(const GURL& url) {
238 return url.is_valid() ? url.host() + url.path() : std::string(); 240 return url.is_valid() ? url.host() + url.path() : std::string();
239 } 241 }
240 242
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 320
319 // Only add valid TemplateURLs to the model. 321 // Only add valid TemplateURLs to the model.
320 if ((*i)->url_ref().IsValid(model->search_terms_data())) { 322 if ((*i)->url_ref().IsValid(model->search_terms_data())) {
321 model->Add(*i); // Takes ownership. 323 model->Add(*i); // Takes ownership.
322 *i = NULL; // Prevent the vector from deleting *i later. 324 *i = NULL; // Prevent the vector from deleting *i later.
323 } 325 }
324 } 326 }
325 } 327 }
326 328
327 ProfileWriter::~ProfileWriter() {} 329 ProfileWriter::~ProfileWriter() {}
OLDNEW
« no previous file with comments | « chrome/browser/history/history_service.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698