| 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/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/string_number_conversions.h" | 11 #include "base/string_number_conversions.h" |
| 12 #include "base/stringprintf.h" | 12 #include "base/stringprintf.h" |
| 13 #include "base/threading/thread.h" | 13 #include "base/threading/thread.h" |
| 14 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
| 15 #include "chrome/browser/bookmarks/bookmark_model.h" | 15 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 16 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 16 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
| 17 #include "chrome/browser/favicon/favicon_service_factory.h" | |
| 18 #include "chrome/browser/history/history_service_factory.h" | 17 #include "chrome/browser/history/history_service_factory.h" |
| 19 #include "chrome/browser/password_manager/password_store.h" | 18 #include "chrome/browser/password_manager/password_store.h" |
| 20 #include "chrome/browser/password_manager/password_store_factory.h" | 19 #include "chrome/browser/password_manager/password_store_factory.h" |
| 21 #include "chrome/browser/prefs/pref_service.h" | 20 #include "chrome/browser/prefs/pref_service.h" |
| 22 #include "chrome/browser/profiles/profile.h" | 21 #include "chrome/browser/profiles/profile.h" |
| 23 #include "chrome/browser/search_engines/template_url.h" | 22 #include "chrome/browser/search_engines/template_url.h" |
| 24 #include "chrome/browser/search_engines/template_url_service.h" | 23 #include "chrome/browser/search_engines/template_url_service.h" |
| 25 #include "chrome/browser/search_engines/template_url_service_factory.h" | 24 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 26 #include "chrome/browser/webdata/web_data_service_factory.h" | 25 #include "chrome/browser/webdata/web_data_service_factory.h" |
| 27 #include "chrome/common/chrome_notification_types.h" | 26 #include "chrome/common/chrome_notification_types.h" |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 | 225 |
| 227 model->EndExtensiveChanges(); | 226 model->EndExtensiveChanges(); |
| 228 | 227 |
| 229 // If the user was previously using a toolbar, we should show the bar. | 228 // If the user was previously using a toolbar, we should show the bar. |
| 230 if (import_to_top_level && !add_all_to_top_level) | 229 if (import_to_top_level && !add_all_to_top_level) |
| 231 ShowBookmarkBar(profile_); | 230 ShowBookmarkBar(profile_); |
| 232 } | 231 } |
| 233 | 232 |
| 234 void ProfileWriter::AddFavicons( | 233 void ProfileWriter::AddFavicons( |
| 235 const std::vector<history::ImportedFaviconUsage>& favicons) { | 234 const std::vector<history::ImportedFaviconUsage>& favicons) { |
| 236 FaviconServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS)-> | 235 profile_->GetFaviconService(Profile::EXPLICIT_ACCESS)-> |
| 237 SetImportedFavicons(favicons); | 236 SetImportedFavicons(favicons); |
| 238 } | 237 } |
| 239 | 238 |
| 240 typedef std::map<std::string, TemplateURL*> HostPathMap; | 239 typedef std::map<std::string, TemplateURL*> HostPathMap; |
| 241 | 240 |
| 242 // Returns the key for the map built by BuildHostPathMap. If url_string is not | 241 // Returns the key for the map built by BuildHostPathMap. If url_string is not |
| 243 // a valid URL, an empty string is returned, otherwise host+path is returned. | 242 // a valid URL, an empty string is returned, otherwise host+path is returned. |
| 244 static std::string HostPathKeyForURL(const GURL& url) { | 243 static std::string HostPathKeyForURL(const GURL& url) { |
| 245 return url.is_valid() ? url.host() + url.path() : std::string(); | 244 return url.is_valid() ? url.host() + url.path() : std::string(); |
| 246 } | 245 } |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 | 320 |
| 322 // Only add valid TemplateURLs to the model. | 321 // Only add valid TemplateURLs to the model. |
| 323 if ((*i)->url_ref().IsValid()) { | 322 if ((*i)->url_ref().IsValid()) { |
| 324 model->AddAndSetProfile(*i, profile_); // Takes ownership. | 323 model->AddAndSetProfile(*i, profile_); // Takes ownership. |
| 325 *i = NULL; // Prevent the vector from deleting *i later. | 324 *i = NULL; // Prevent the vector from deleting *i later. |
| 326 } | 325 } |
| 327 } | 326 } |
| 328 } | 327 } |
| 329 | 328 |
| 330 ProfileWriter::~ProfileWriter() {} | 329 ProfileWriter::~ProfileWriter() {} |
| OLD | NEW |