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

Side by Side Diff: chrome/utility/importer/ie_importer_win.cc

Issue 616763002: Importing certain bookmarks from firefox and HTML file as search engines. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed dependency issue. Created 5 years, 11 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/utility/importer/firefox_importer.cc ('k') | components/search_engines/BUILD.gn » ('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) 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/utility/importer/ie_importer_win.h" 5 #include "chrome/utility/importer/ie_importer_win.h"
6 6
7 #include <ole2.h> 7 #include <ole2.h>
8 #include <intshcut.h> 8 #include <intshcut.h>
9 #include <shlobj.h> 9 #include <shlobj.h>
10 #include <urlhist.h> 10 #include <urlhist.h>
(...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after
717 SearchEnginesMap::iterator t_iter = search_engines_map.find(url); 717 SearchEnginesMap::iterator t_iter = search_engines_map.find(url);
718 if (t_iter == search_engines_map.end()) { 718 if (t_iter == search_engines_map.end()) {
719 // First time we see that URL. 719 // First time we see that URL.
720 GURL gurl(url); 720 GURL gurl(url);
721 if (gurl.is_valid()) { 721 if (gurl.is_valid()) {
722 t_iter = search_engines_map.insert(std::make_pair(url, name)).first; 722 t_iter = search_engines_map.insert(std::make_pair(url, name)).first;
723 } 723 }
724 } 724 }
725 } 725 }
726 // ProfileWriter::AddKeywords() requires a vector and we have a map. 726 // ProfileWriter::AddKeywords() requires a vector and we have a map.
727 std::vector<importer::URLKeywordInfo> url_keywords; 727 std::vector<importer::SearchEngineInfo> search_engines;
728 for (SearchEnginesMap::iterator i = search_engines_map.begin(); 728 for (SearchEnginesMap::iterator i = search_engines_map.begin();
729 i != search_engines_map.end(); ++i) { 729 i != search_engines_map.end(); ++i) {
730 importer::URLKeywordInfo url_keyword_info; 730 importer::SearchEngineInfo search_engine_info;
731 url_keyword_info.url = GURL(i->first); 731 search_engine_info.url = base::UTF8ToUTF16(i->first);
732 url_keyword_info.display_name = i->second; 732 search_engine_info.display_name = i->second;
733 url_keywords.push_back(url_keyword_info); 733 search_engines.push_back(search_engine_info);
734 } 734 }
735 bridge_->SetKeywords(url_keywords, true); 735 bridge_->SetKeywords(search_engines, true);
736 } 736 }
737 737
738 void IEImporter::ImportHomepage() { 738 void IEImporter::ImportHomepage() {
739 const wchar_t* kIEHomepage = L"Start Page"; 739 const wchar_t* kIEHomepage = L"Start Page";
740 const wchar_t* kIEDefaultHomepage = L"Default_Page_URL"; 740 const wchar_t* kIEDefaultHomepage = L"Default_Page_URL";
741 741
742 base::string16 key_path(importer::GetIESettingsKey()); 742 base::string16 key_path(importer::GetIESettingsKey());
743 743
744 base::win::RegKey key(HKEY_CURRENT_USER, key_path.c_str(), KEY_READ); 744 base::win::RegKey key(HKEY_CURRENT_USER, key_path.c_str(), KEY_READ);
745 base::string16 homepage_url; 745 base::string16 homepage_url;
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
883 static int version = -1; 883 static int version = -1;
884 if (version < 0) { 884 if (version < 0) {
885 wchar_t buffer[128]; 885 wchar_t buffer[128];
886 DWORD buffer_length = sizeof(buffer); 886 DWORD buffer_length = sizeof(buffer);
887 base::win::RegKey reg_key(HKEY_LOCAL_MACHINE, kIEVersionKey, KEY_READ); 887 base::win::RegKey reg_key(HKEY_LOCAL_MACHINE, kIEVersionKey, KEY_READ);
888 LONG result = reg_key.ReadValue(L"Version", buffer, &buffer_length, NULL); 888 LONG result = reg_key.ReadValue(L"Version", buffer, &buffer_length, NULL);
889 version = ((result == ERROR_SUCCESS)? _wtoi(buffer) : 0); 889 version = ((result == ERROR_SUCCESS)? _wtoi(buffer) : 0);
890 } 890 }
891 return version; 891 return version;
892 } 892 }
OLDNEW
« no previous file with comments | « chrome/utility/importer/firefox_importer.cc ('k') | components/search_engines/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698