OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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> |
11 #include <urlhist.h> | 11 #include <urlhist.h> |
12 | 12 |
13 #include <algorithm> | 13 #include <algorithm> |
14 #include <map> | 14 #include <map> |
15 #include <string> | 15 #include <string> |
16 #include <vector> | 16 #include <vector> |
17 | 17 |
18 #include "base/file_path.h" | 18 #include "base/file_path.h" |
19 #include "base/file_util.h" | 19 #include "base/file_util.h" |
| 20 #include "base/string16.h" |
20 #include "base/string_split.h" | 21 #include "base/string_split.h" |
21 #include "base/string_util.h" | 22 #include "base/string_util.h" |
22 #include "base/string16.h" | |
23 #include "base/time.h" | 23 #include "base/time.h" |
24 #include "base/utf_string_conversions.h" | 24 #include "base/utf_string_conversions.h" |
25 #include "base/win/registry.h" | 25 #include "base/win/registry.h" |
26 #include "base/win/scoped_co_mem.h" | 26 #include "base/win/scoped_co_mem.h" |
27 #include "base/win/scoped_com_initializer.h" | 27 #include "base/win/scoped_com_initializer.h" |
28 #include "base/win/scoped_comptr.h" | 28 #include "base/win/scoped_comptr.h" |
29 #include "base/win/scoped_handle.h" | 29 #include "base/win/scoped_handle.h" |
30 #include "base/win/windows_version.h" | 30 #include "base/win/windows_version.h" |
31 #include "chrome/browser/importer/importer_bridge.h" | 31 #include "chrome/browser/importer/importer_bridge.h" |
32 #include "chrome/browser/importer/importer_data_types.h" | 32 #include "chrome/browser/importer/importer_data_types.h" |
33 #include "chrome/browser/password_manager/ie7_password.h" | 33 #include "chrome/browser/password_manager/ie7_password.h" |
34 #include "chrome/browser/search_engines/template_url.h" | 34 #include "chrome/browser/search_engines/template_url.h" |
35 #include "chrome/browser/search_engines/template_url_prepopulate_data.h" | 35 #include "chrome/browser/search_engines/template_url_prepopulate_data.h" |
36 #include "chrome/browser/search_engines/template_url_service.h" | 36 #include "chrome/browser/search_engines/template_url_service.h" |
37 #include "chrome/common/time_format.h" | 37 #include "chrome/common/time_format.h" |
38 #include "chrome/common/url_constants.h" | 38 #include "chrome/common/url_constants.h" |
39 #include "googleurl/src/gurl.h" | 39 #include "googleurl/src/gurl.h" |
40 #include "grit/generated_resources.h" | 40 #include "grit/generated_resources.h" |
41 #include "ui/base/l10n/l10n_util.h" | 41 #include "ui/base/l10n/l10n_util.h" |
42 #include "webkit/glue/password_form.h" | 42 #include "webkit/forms/password_form.h" |
43 | 43 |
44 namespace { | 44 namespace { |
45 | 45 |
46 // A struct that hosts the information of AutoComplete data in PStore. | 46 // A struct that hosts the information of AutoComplete data in PStore. |
47 struct AutoCompleteInfo { | 47 struct AutoCompleteInfo { |
48 string16 key; | 48 string16 key; |
49 std::vector<string16> data; | 49 std::vector<string16> data; |
50 bool is_url; | 50 bool is_url; |
51 }; | 51 }; |
52 | 52 |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 for (i = 0; i < ac_list.size(); i++) { | 273 for (i = 0; i < ac_list.size(); i++) { |
274 if (!ac_list[i].is_url || ac_list[i].data.size() < 2) | 274 if (!ac_list[i].is_url || ac_list[i].data.size() < 2) |
275 continue; | 275 continue; |
276 | 276 |
277 GURL url(ac_list[i].key.c_str()); | 277 GURL url(ac_list[i].key.c_str()); |
278 if (!(LowerCaseEqualsASCII(url.scheme(), chrome::kHttpScheme) || | 278 if (!(LowerCaseEqualsASCII(url.scheme(), chrome::kHttpScheme) || |
279 LowerCaseEqualsASCII(url.scheme(), chrome::kHttpsScheme))) { | 279 LowerCaseEqualsASCII(url.scheme(), chrome::kHttpsScheme))) { |
280 continue; | 280 continue; |
281 } | 281 } |
282 | 282 |
283 webkit_glue::PasswordForm form; | 283 webkit::forms::PasswordForm form; |
284 GURL::Replacements rp; | 284 GURL::Replacements rp; |
285 rp.ClearUsername(); | 285 rp.ClearUsername(); |
286 rp.ClearPassword(); | 286 rp.ClearPassword(); |
287 rp.ClearQuery(); | 287 rp.ClearQuery(); |
288 rp.ClearRef(); | 288 rp.ClearRef(); |
289 form.origin = url.ReplaceComponents(rp); | 289 form.origin = url.ReplaceComponents(rp); |
290 form.username_value = ac_list[i].data[0]; | 290 form.username_value = ac_list[i].data[0]; |
291 form.password_value = ac_list[i].data[1]; | 291 form.password_value = ac_list[i].data[1]; |
292 form.signon_realm = url.GetOrigin().spec(); | 292 form.signon_realm = url.GetOrigin().spec(); |
293 | 293 |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
587 if (version < 0) { | 587 if (version < 0) { |
588 wchar_t buffer[128]; | 588 wchar_t buffer[128]; |
589 DWORD buffer_length = sizeof(buffer); | 589 DWORD buffer_length = sizeof(buffer); |
590 base::win::RegKey reg_key(HKEY_LOCAL_MACHINE, | 590 base::win::RegKey reg_key(HKEY_LOCAL_MACHINE, |
591 L"Software\\Microsoft\\Internet Explorer", KEY_READ); | 591 L"Software\\Microsoft\\Internet Explorer", KEY_READ); |
592 LONG result = reg_key.ReadValue(L"Version", buffer, &buffer_length, NULL); | 592 LONG result = reg_key.ReadValue(L"Version", buffer, &buffer_length, NULL); |
593 version = ((result == ERROR_SUCCESS)? _wtoi(buffer) : 0); | 593 version = ((result == ERROR_SUCCESS)? _wtoi(buffer) : 0); |
594 } | 594 } |
595 return version; | 595 return version; |
596 } | 596 } |
OLD | NEW |