OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/importer.h" | 5 #include "chrome/browser/importer/importer.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "app/gfx/favicon_size.h" | 10 #include "app/gfx/favicon_size.h" |
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
540 task_ = NewRunnableMethod(importer_, &Importer::StartImport, | 540 task_ = NewRunnableMethod(importer_, &Importer::StartImport, |
541 profile_info, items, writer_.get(), file_loop_, this); | 541 profile_info, items, writer_.get(), file_loop_, this); |
542 | 542 |
543 // We should lock the Firefox profile directory to prevent corruption. | 543 // We should lock the Firefox profile directory to prevent corruption. |
544 if (profile_info.browser_type == FIREFOX2 || | 544 if (profile_info.browser_type == FIREFOX2 || |
545 profile_info.browser_type == FIREFOX3) { | 545 profile_info.browser_type == FIREFOX3) { |
546 firefox_lock_.reset(new FirefoxProfileLock(profile_info.source_path)); | 546 firefox_lock_.reset(new FirefoxProfileLock(profile_info.source_path)); |
547 if (!firefox_lock_->HasAcquired()) { | 547 if (!firefox_lock_->HasAcquired()) { |
548 // If fail to acquire the lock, we set the source unreadable and | 548 // If fail to acquire the lock, we set the source unreadable and |
549 // show a warning dialog. | 549 // show a warning dialog. |
| 550 // However, if we're running without a UI (silently) and trying to |
| 551 // import just the home page, then import anyway. The home page setting |
| 552 // is stored in an unlocked text file, so it is the only preference safe |
| 553 // to import even if Firefox is running. |
| 554 if (items == HOME_PAGE && first_run && this->headless_) { |
| 555 AddRef(); |
| 556 InvokeTaskIfDone(); |
| 557 return; |
| 558 } |
550 is_source_readable_ = false; | 559 is_source_readable_ = false; |
551 ShowWarningDialog(); | 560 ShowWarningDialog(); |
552 } | 561 } |
553 } | 562 } |
554 | 563 |
555 #if defined(OS_WIN) | 564 #if defined(OS_WIN) |
556 // For google toolbar import, we need the user to log in and store their GAIA | 565 // For google toolbar import, we need the user to log in and store their GAIA |
557 // credentials. | 566 // credentials. |
558 if (profile_info.browser_type == GOOGLE_TOOLBAR5) { | 567 if (profile_info.browser_type == GOOGLE_TOOLBAR5) { |
559 if (!toolbar_importer_utils::IsGoogleGAIACookieInstalled()) { | 568 if (!toolbar_importer_utils::IsGoogleGAIACookieInstalled()) { |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
822 // TODO(jeremy):Check that Safari folder is in fact present. | 831 // TODO(jeremy):Check that Safari folder is in fact present. |
823 ProfileInfo* safari = new ProfileInfo(); | 832 ProfileInfo* safari = new ProfileInfo(); |
824 safari->browser_type = SAFARI; | 833 safari->browser_type = SAFARI; |
825 safari->description = l10n_util::GetString(IDS_IMPORT_FROM_SAFARI); | 834 safari->description = l10n_util::GetString(IDS_IMPORT_FROM_SAFARI); |
826 safari->source_path.clear(); | 835 safari->source_path.clear(); |
827 safari->app_path.clear(); | 836 safari->app_path.clear(); |
828 safari->services_supported = HISTORY | FAVORITES | HOME_PAGE; | 837 safari->services_supported = HISTORY | FAVORITES | HOME_PAGE; |
829 source_profiles_.push_back(safari); | 838 source_profiles_.push_back(safari); |
830 } | 839 } |
831 #endif // OS_MACOSX | 840 #endif // OS_MACOSX |
OLD | NEW |