| 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/password_manager/password_store.h" | 16 #include "chrome/browser/password_manager/password_store.h" |
| 17 #include "chrome/browser/password_manager/password_store_factory.h" |
| 17 #include "chrome/browser/prefs/pref_service.h" | 18 #include "chrome/browser/prefs/pref_service.h" |
| 18 #include "chrome/browser/profiles/profile.h" | 19 #include "chrome/browser/profiles/profile.h" |
| 19 #include "chrome/browser/search_engines/template_url.h" | 20 #include "chrome/browser/search_engines/template_url.h" |
| 20 #include "chrome/browser/search_engines/template_url_service.h" | 21 #include "chrome/browser/search_engines/template_url_service.h" |
| 21 #include "chrome/browser/search_engines/template_url_service_factory.h" | 22 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 22 #include "chrome/common/chrome_notification_types.h" | 23 #include "chrome/common/chrome_notification_types.h" |
| 23 #include "chrome/common/pref_names.h" | 24 #include "chrome/common/pref_names.h" |
| 24 | 25 |
| 25 namespace { | 26 namespace { |
| 26 | 27 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 | 81 |
| 81 bool ProfileWriter::BookmarkModelIsLoaded() const { | 82 bool ProfileWriter::BookmarkModelIsLoaded() const { |
| 82 return profile_->GetBookmarkModel()->IsLoaded(); | 83 return profile_->GetBookmarkModel()->IsLoaded(); |
| 83 } | 84 } |
| 84 | 85 |
| 85 bool ProfileWriter::TemplateURLServiceIsLoaded() const { | 86 bool ProfileWriter::TemplateURLServiceIsLoaded() const { |
| 86 return TemplateURLServiceFactory::GetForProfile(profile_)->loaded(); | 87 return TemplateURLServiceFactory::GetForProfile(profile_)->loaded(); |
| 87 } | 88 } |
| 88 | 89 |
| 89 void ProfileWriter::AddPasswordForm(const webkit::forms::PasswordForm& form) { | 90 void ProfileWriter::AddPasswordForm(const webkit::forms::PasswordForm& form) { |
| 90 profile_->GetPasswordStore(Profile::EXPLICIT_ACCESS)->AddLogin(form); | 91 PasswordStoreFactory::GetForProfile( |
| 92 profile_, Profile::EXPLICIT_ACCESS)->AddLogin(form); |
| 91 } | 93 } |
| 92 | 94 |
| 93 #if defined(OS_WIN) | 95 #if defined(OS_WIN) |
| 94 void ProfileWriter::AddIE7PasswordInfo(const IE7PasswordInfo& info) { | 96 void ProfileWriter::AddIE7PasswordInfo(const IE7PasswordInfo& info) { |
| 95 profile_->GetWebDataService(Profile::EXPLICIT_ACCESS)->AddIE7Login(info); | 97 profile_->GetWebDataService(Profile::EXPLICIT_ACCESS)->AddIE7Login(info); |
| 96 } | 98 } |
| 97 #endif | 99 #endif |
| 98 | 100 |
| 99 void ProfileWriter::AddHistoryPage(const history::URLRows& page, | 101 void ProfileWriter::AddHistoryPage(const history::URLRows& page, |
| 100 history::VisitSource visit_source) { | 102 history::VisitSource visit_source) { |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 if (default_keyword && TemplateURL::SupportsReplacement(t_url)) | 343 if (default_keyword && TemplateURL::SupportsReplacement(t_url)) |
| 342 model->SetDefaultSearchProvider(t_url); | 344 model->SetDefaultSearchProvider(t_url); |
| 343 } else { | 345 } else { |
| 344 // Don't add invalid TemplateURLs to the model. | 346 // Don't add invalid TemplateURLs to the model. |
| 345 delete t_url; | 347 delete t_url; |
| 346 } | 348 } |
| 347 } | 349 } |
| 348 } | 350 } |
| 349 | 351 |
| 350 ProfileWriter::~ProfileWriter() {} | 352 ProfileWriter::~ProfileWriter() {} |
| OLD | NEW |