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

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

Issue 31014: Port DictionaryValue to use string16 instead of wstring. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/extensions/extensions_ui.cc ('k') | chrome/browser/metrics/metrics_log.cc » ('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 "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after
651 #if defined(OS_WIN) 651 #if defined(OS_WIN)
652 std::wstring ini_file = GetProfilesINI(); 652 std::wstring ini_file = GetProfilesINI();
653 ParseProfileINI(ini_file, &root); 653 ParseProfileINI(ini_file, &root);
654 #else 654 #else
655 // TODO(port): Do we need to concern ourselves with profiles on posix? 655 // TODO(port): Do we need to concern ourselves with profiles on posix?
656 NOTIMPLEMENTED(); 656 NOTIMPLEMENTED();
657 #endif 657 #endif
658 658
659 std::wstring source_path; 659 std::wstring source_path;
660 for (int i = 0; ; ++i) { 660 for (int i = 0; ; ++i) {
661 std::wstring current_profile = L"Profile" + IntToWString(i); 661 string16 current_profile = ASCIIToUTF16("Profile") + IntToString16(i);
662 if (!root.HasKey(current_profile)) { 662 if (!root.HasKey(current_profile)) {
663 // Profiles are continuously numbered. So we exit when we can't 663 // Profiles are continuously numbered. So we exit when we can't
664 // find the i-th one. 664 // find the i-th one.
665 break; 665 break;
666 } 666 }
667 std::wstring is_relative, path, profile_path; 667 string16 is_relative, path, profile_path;
668 if (root.GetString(current_profile + L".IsRelative", &is_relative) && 668 if (root.GetString(current_profile + ASCIIToUTF16(".IsRelative"),
669 root.GetString(current_profile + L".Path", &path)) { 669 &is_relative) &&
670 string16 path16 = WideToUTF16Hack(path); 670 root.GetString(current_profile + ASCIIToUTF16(".Path"), &path)) {
671 ReplaceSubstringsAfterOffset( 671 ReplaceSubstringsAfterOffset(
672 &path16, 0, ASCIIToUTF16("/"), ASCIIToUTF16("\\")); 672 &path, 0, ASCIIToUTF16("/"), ASCIIToUTF16("\\"));
673 path.assign(UTF16ToWideHack(path16));
674 673
675 #if defined(OS_WIN) 674 #if defined(OS_WIN)
676 // IsRelative=1 means the folder path would be relative to the 675 // IsRelative=1 means the folder path would be relative to the
677 // path of profiles.ini. IsRelative=0 refers to a custom profile 676 // path of profiles.ini. IsRelative=0 refers to a custom profile
678 // location. 677 // location.
679 if (is_relative == L"1") { 678 if (is_relative == ASCIIToUTF16("1")) {
680 profile_path = file_util::GetDirectoryFromPath(ini_file); 679 profile_path = file_util::GetDirectoryFromPath(ini_file);
681 file_util::AppendToPath(&profile_path, path); 680 file_util::AppendToPath(&profile_path, path);
682 } else { 681 } else {
683 profile_path = path; 682 profile_path = path;
684 } 683 }
685 #endif 684 #endif
686 685
687 // We only import the default profile when multiple profiles exist, 686 // We only import the default profile when multiple profiles exist,
688 // since the other profiles are used mostly by developers for testing. 687 // since the other profiles are used mostly by developers for testing.
689 // Otherwise, Profile0 will be imported. 688 // Otherwise, Profile0 will be imported.
690 std::wstring is_default; 689 string16 is_default;
691 if ((root.GetString(current_profile + L".Default", &is_default) && 690 if ((root.GetString(current_profile + ASCIIToUTF16(".Default"),
692 is_default == L"1") || i == 0) { 691 &is_default) &&
693 source_path = profile_path; 692 is_default == ASCIIToUTF16("1")) || i == 0) {
693 source_path = UTF16ToWideHack(profile_path);
694 // We break out of the loop when we have found the default profile. 694 // We break out of the loop when we have found the default profile.
695 if (is_default == L"1") 695 if (is_default == ASCIIToUTF16("1"))
696 break; 696 break;
697 } 697 }
698 } 698 }
699 } 699 }
700 700
701 if (!source_path.empty()) { 701 if (!source_path.empty()) {
702 ProfileInfo* firefox = new ProfileInfo(); 702 ProfileInfo* firefox = new ProfileInfo();
703 firefox->description = l10n_util::GetString(IDS_IMPORT_FROM_FIREFOX); 703 firefox->description = l10n_util::GetString(IDS_IMPORT_FROM_FIREFOX);
704 firefox->browser_type = firefox_type; 704 firefox->browser_type = firefox_type;
705 firefox->source_path = source_path; 705 firefox->source_path = source_path;
706 firefox->app_path = GetFirefoxInstallPath(); 706 firefox->app_path = GetFirefoxInstallPath();
707 firefox->services_supported = HISTORY | FAVORITES | COOKIES | PASSWORDS | 707 firefox->services_supported = HISTORY | FAVORITES | COOKIES | PASSWORDS |
708 SEARCH_ENGINES; 708 SEARCH_ENGINES;
709 source_profiles_.push_back(firefox); 709 source_profiles_.push_back(firefox);
710 } 710 }
711 } 711 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extensions_ui.cc ('k') | chrome/browser/metrics/metrics_log.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698