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