| 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/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" |
| 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.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.h" | 25 #include "chrome/browser/webdata/web_data_service.h" |
| 27 #include "chrome/common/importer/imported_bookmark_entry.h" | 26 #include "chrome/common/importer/imported_bookmark_entry.h" |
| 28 #include "chrome/common/importer/imported_favicon_usage.h" | 27 #include "chrome/common/importer/imported_favicon_usage.h" |
| 29 #include "chrome/common/pref_names.h" | 28 #include "chrome/common/pref_names.h" |
| 30 #include "components/bookmarks/browser/bookmark_model.h" | 29 #include "components/bookmarks/browser/bookmark_model.h" |
| 31 #include "components/password_manager/core/browser/password_store.h" | 30 #include "components/password_manager/core/browser/password_store.h" |
| 32 #include "components/search_engines/template_url.h" | 31 #include "components/search_engines/template_url.h" |
| 32 #include "components/search_engines/template_url_service.h" |
| 33 | 33 |
| 34 namespace { | 34 namespace { |
| 35 | 35 |
| 36 // Generates a unique folder name. If |folder_name| is not unique, then this | 36 // Generates a unique folder name. If |folder_name| is not unique, then this |
| 37 // repeatedly tests for '|folder_name| + (i)' until a unique name is found. | 37 // repeatedly tests for '|folder_name| + (i)' until a unique name is found. |
| 38 base::string16 GenerateUniqueFolderName(BookmarkModel* model, | 38 base::string16 GenerateUniqueFolderName(BookmarkModel* model, |
| 39 const base::string16& folder_name) { | 39 const base::string16& folder_name) { |
| 40 // Build a set containing the bookmark bar folder names. | 40 // Build a set containing the bookmark bar folder names. |
| 41 std::set<base::string16> existing_folder_names; | 41 std::set<base::string16> existing_folder_names; |
| 42 const BookmarkNode* bookmark_bar = model->bookmark_bar_node(); | 42 const BookmarkNode* bookmark_bar = model->bookmark_bar_node(); |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 | 318 |
| 319 // Only add valid TemplateURLs to the model. | 319 // Only add valid TemplateURLs to the model. |
| 320 if ((*i)->url_ref().IsValid(model->search_terms_data())) { | 320 if ((*i)->url_ref().IsValid(model->search_terms_data())) { |
| 321 model->Add(*i); // Takes ownership. | 321 model->Add(*i); // Takes ownership. |
| 322 *i = NULL; // Prevent the vector from deleting *i later. | 322 *i = NULL; // Prevent the vector from deleting *i later. |
| 323 } | 323 } |
| 324 } | 324 } |
| 325 } | 325 } |
| 326 | 326 |
| 327 ProfileWriter::~ProfileWriter() {} | 327 ProfileWriter::~ProfileWriter() {} |
| OLD | NEW |