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/ie_importer.h" | 5 #include "chrome/browser/importer/ie_importer.h" |
6 | 6 |
7 #include <ole2.h> | 7 #include <ole2.h> |
8 #include <intshcut.h> | 8 #include <intshcut.h> |
9 #include <pstore.h> | 9 #include <pstore.h> |
10 #include <shlobj.h> | 10 #include <shlobj.h> |
(...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
577 continue; | 577 continue; |
578 } | 578 } |
579 } | 579 } |
580 | 580 |
581 std::string url(WideToUTF8(wide_url)); | 581 std::string url(WideToUTF8(wide_url)); |
582 SearchEnginesMap::iterator t_iter = search_engines_map.find(url); | 582 SearchEnginesMap::iterator t_iter = search_engines_map.find(url); |
583 if (t_iter == search_engines_map.end()) { | 583 if (t_iter == search_engines_map.end()) { |
584 // First time we see that URL. | 584 // First time we see that URL. |
585 GURL gurl(url); | 585 GURL gurl(url); |
586 if (gurl.is_valid()) { | 586 if (gurl.is_valid()) { |
587 TemplateURL* template_url = new TemplateURL(); | 587 TemplateURLData data; |
588 template_url->set_short_name(name); | 588 data.short_name = name; |
589 template_url->SetURL(url); | 589 data.SetKeyword(TemplateURLService::GenerateKeyword(gurl, false)); |
590 // Give this a keyword to facilitate tab-to-search, if possible. | 590 data.SetURL(url); |
591 template_url->set_keyword(TemplateURLService::GenerateKeyword(gurl, | 591 data.show_in_default_list = true; |
592 false)); | 592 t_iter = search_engines_map.insert(std::make_pair(url, |
593 template_url->set_show_in_default_list(true); | 593 new TemplateURL(data))).first; |
594 search_engines_map.insert(std::make_pair(url, template_url)); | |
595 } | 594 } |
596 } | 595 } |
597 } | 596 } |
598 | 597 |
599 // ProfileWriter::AddKeywords() requires a vector and we have a map. | 598 // ProfileWriter::AddKeywords() requires a vector and we have a map. |
600 std::vector<TemplateURL*> search_engines; | 599 std::vector<TemplateURL*> search_engines; |
601 for (SearchEnginesMap::iterator i = search_engines_map.begin(); | 600 for (SearchEnginesMap::iterator i = search_engines_map.begin(); |
602 i != search_engines_map.end(); ++i) | 601 i != search_engines_map.end(); ++i) |
603 search_engines.push_back(i->second); | 602 search_engines.push_back(i->second); |
604 | 603 |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
753 static int version = -1; | 752 static int version = -1; |
754 if (version < 0) { | 753 if (version < 0) { |
755 wchar_t buffer[128]; | 754 wchar_t buffer[128]; |
756 DWORD buffer_length = sizeof(buffer); | 755 DWORD buffer_length = sizeof(buffer); |
757 base::win::RegKey reg_key(HKEY_LOCAL_MACHINE, kIEVersionKey, KEY_READ); | 756 base::win::RegKey reg_key(HKEY_LOCAL_MACHINE, kIEVersionKey, KEY_READ); |
758 LONG result = reg_key.ReadValue(L"Version", buffer, &buffer_length, NULL); | 757 LONG result = reg_key.ReadValue(L"Version", buffer, &buffer_length, NULL); |
759 version = ((result == ERROR_SUCCESS)? _wtoi(buffer) : 0); | 758 version = ((result == ERROR_SUCCESS)? _wtoi(buffer) : 0); |
760 } | 759 } |
761 return version; | 760 return version; |
762 } | 761 } |
OLD | NEW |