Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(80)

Side by Side Diff: chrome/browser/importer/importer.cc

Issue 114047: Add import progress indicator dialog. (Closed)
Patch Set: code review fixes Created 11 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/importer/importer.h ('k') | chrome/chrome.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 25 matching lines...) Expand all
36 #include "chrome/common/pref_names.h" 36 #include "chrome/common/pref_names.h"
37 #include "chrome/common/pref_service.h" 37 #include "chrome/common/pref_service.h"
38 #include "grit/generated_resources.h" 38 #include "grit/generated_resources.h"
39 #include "skia/ext/image_operations.h" 39 #include "skia/ext/image_operations.h"
40 #include "webkit/glue/image_decoder.h" 40 #include "webkit/glue/image_decoder.h"
41 41
42 // TODO(port): Port these files. 42 // TODO(port): Port these files.
43 #if defined(OS_WIN) 43 #if defined(OS_WIN)
44 #include "chrome/browser/views/importer_lock_view.h" 44 #include "chrome/browser/views/importer_lock_view.h"
45 #include "views/window/window.h" 45 #include "views/window/window.h"
46 #elif defined(OS_LINUX)
47 #include "chrome/browser/gtk/import_lock_dialog_gtk.h"
46 #endif 48 #endif
47 49
48 // ProfileWriter. 50 // ProfileWriter.
49 51
50 bool ProfileWriter::BookmarkModelIsLoaded() const { 52 bool ProfileWriter::BookmarkModelIsLoaded() const {
51 return profile_->GetBookmarkModel()->IsLoaded(); 53 return profile_->GetBookmarkModel()->IsLoaded();
52 } 54 }
53 55
54 bool ProfileWriter::TemplateURLModelIsLoaded() const { 56 bool ProfileWriter::TemplateURLModelIsLoaded() const {
55 return profile_->GetTemplateURLModel()->loaded(); 57 return profile_->GetTemplateURLModel()->loaded();
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 InvokeTaskIfDone(); 436 InvokeTaskIfDone();
435 } 437 }
436 438
437 void ImporterHost::ShowWarningDialog() { 439 void ImporterHost::ShowWarningDialog() {
438 if (headless_) { 440 if (headless_) {
439 OnLockViewEnd(false); 441 OnLockViewEnd(false);
440 } else { 442 } else {
441 #if defined(OS_WIN) 443 #if defined(OS_WIN)
442 views::Window::CreateChromeWindow(GetActiveWindow(), gfx::Rect(), 444 views::Window::CreateChromeWindow(GetActiveWindow(), gfx::Rect(),
443 new ImporterLockView(this))->Show(); 445 new ImporterLockView(this))->Show();
446 #elif defined(OS_LINUX)
447 ImportLockDialogGtk::Show(NULL, this);
444 #else 448 #else
445 // TODO(port): Need CreateChromeWindow. 449 // TODO(port): Need CreateChromeWindow.
446 NOTIMPLEMENTED(); 450 NOTIMPLEMENTED();
447 #endif 451 #endif
448 } 452 }
449 } 453 }
450 454
451 void ImporterHost::OnLockViewEnd(bool is_continue) { 455 void ImporterHost::OnLockViewEnd(bool is_continue) {
452 if (is_continue) { 456 if (is_continue) {
453 // User chose to continue, then we check the lock again to make 457 // User chose to continue, then we check the lock again to make
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
704 // We break out of the loop when we have found the default profile. 708 // We break out of the loop when we have found the default profile.
705 if (is_default == L"1") 709 if (is_default == L"1")
706 break; 710 break;
707 } 711 }
708 } 712 }
709 } 713 }
710 714
711 // Detects which version of Firefox is installed. 715 // Detects which version of Firefox is installed.
712 ProfileType firefox_type; 716 ProfileType firefox_type;
713 std::wstring app_path; 717 std::wstring app_path;
714 int version = GetCurrentFirefoxMajorVersion(); 718 int version = 0;
719 #if defined(OS_WIN)
720 version = GetCurrentFirefoxMajorVersionFromRegistry();
721 #endif
715 if (version != 2 && version != 3) 722 if (version != 2 && version != 3)
716 GetFirefoxVersionAndPathFromProfile(source_path, &version, &app_path); 723 GetFirefoxVersionAndPathFromProfile(source_path, &version, &app_path);
724
717 if (version == 2) { 725 if (version == 2) {
718 firefox_type = FIREFOX2; 726 firefox_type = FIREFOX2;
719 } else if (version == 3) { 727 } else if (version == 3) {
720 firefox_type = FIREFOX3; 728 firefox_type = FIREFOX3;
721 } else { 729 } else {
722 // Ignores other versions of firefox. 730 // Ignores other versions of firefox.
723 return; 731 return;
724 } 732 }
725 733
726 if (!source_path.empty()) { 734 if (!source_path.empty()) {
727 ProfileInfo* firefox = new ProfileInfo(); 735 ProfileInfo* firefox = new ProfileInfo();
728 firefox->description = l10n_util::GetString(IDS_IMPORT_FROM_FIREFOX); 736 firefox->description = l10n_util::GetString(IDS_IMPORT_FROM_FIREFOX);
729 firefox->browser_type = firefox_type; 737 firefox->browser_type = firefox_type;
730 firefox->source_path = source_path; 738 firefox->source_path = source_path;
731 firefox->app_path = GetFirefoxInstallPath(); 739 #if defined(OS_WIN)
740 firefox->app_path = GetFirefoxInstallPathFromRegistry();
741 #endif
732 if (firefox->app_path.empty()) 742 if (firefox->app_path.empty())
733 firefox->app_path = app_path; 743 firefox->app_path = app_path;
734 firefox->services_supported = HISTORY | FAVORITES | COOKIES | PASSWORDS | 744 firefox->services_supported = HISTORY | FAVORITES | COOKIES | PASSWORDS |
735 SEARCH_ENGINES; 745 SEARCH_ENGINES;
736 source_profiles_.push_back(firefox); 746 source_profiles_.push_back(firefox);
737 } 747 }
738 #endif 748 #endif
739 } 749 }
740 750
741 void ImporterHost::DetectGoogleToolbarProfiles() { 751 void ImporterHost::DetectGoogleToolbarProfiles() {
742 if (!FirstRun::IsChromeFirstRun()) { 752 if (!FirstRun::IsChromeFirstRun()) {
743 ProfileInfo* google_toolbar = new ProfileInfo(); 753 ProfileInfo* google_toolbar = new ProfileInfo();
744 google_toolbar->browser_type = GOOGLE_TOOLBAR5; 754 google_toolbar->browser_type = GOOGLE_TOOLBAR5;
745 google_toolbar->description = l10n_util::GetString( 755 google_toolbar->description = l10n_util::GetString(
746 IDS_IMPORT_FROM_GOOGLE_TOOLBAR); 756 IDS_IMPORT_FROM_GOOGLE_TOOLBAR);
747 google_toolbar->source_path.clear(); 757 google_toolbar->source_path.clear();
748 google_toolbar->app_path.clear(); 758 google_toolbar->app_path.clear();
749 google_toolbar->services_supported = FAVORITES; 759 google_toolbar->services_supported = FAVORITES;
750 source_profiles_.push_back(google_toolbar); 760 source_profiles_.push_back(google_toolbar);
751 } 761 }
752 } 762 }
OLDNEW
« no previous file with comments | « chrome/browser/importer/importer.h ('k') | chrome/chrome.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698