| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 // The order of these includes is important. | 5 // The order of these includes is important. |
| 6 #include <windows.h> | 6 #include <windows.h> |
| 7 #include <unknwn.h> | 7 #include <unknwn.h> |
| 8 #include <intshcut.h> | 8 #include <intshcut.h> |
| 9 #include <propvarutil.h> | 9 #include <propvarutil.h> |
| 10 #include <shlguid.h> | 10 #include <shlguid.h> |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 return false; | 196 return false; |
| 197 } | 197 } |
| 198 } | 198 } |
| 199 | 199 |
| 200 // Save the .url file. | 200 // Save the .url file. |
| 201 result = persist_file->Save(file.value().c_str(), TRUE); | 201 result = persist_file->Save(file.value().c_str(), TRUE); |
| 202 if (FAILED(result)) | 202 if (FAILED(result)) |
| 203 return false; | 203 return false; |
| 204 | 204 |
| 205 // Write dummy favicon image data in NTFS alternate data stream. | 205 // Write dummy favicon image data in NTFS alternate data stream. |
| 206 return favicon_url.empty() || (file_util::WriteFile( | 206 return favicon_url.empty() || (base::WriteFile( |
| 207 file.ReplaceExtension(kFaviconStreamSuffix), kDummyFaviconImageData, | 207 file.ReplaceExtension(kFaviconStreamSuffix), kDummyFaviconImageData, |
| 208 sizeof kDummyFaviconImageData) != -1); | 208 sizeof kDummyFaviconImageData) != -1); |
| 209 } | 209 } |
| 210 | 210 |
| 211 bool CreateUrlFile(const base::FilePath& file, const base::string16& url) { | 211 bool CreateUrlFile(const base::FilePath& file, const base::string16& url) { |
| 212 return CreateUrlFileWithFavicon(file, url, base::string16()); | 212 return CreateUrlFileWithFavicon(file, url, base::string16()); |
| 213 } | 213 } |
| 214 | 214 |
| 215 void ClearPStoreType(IPStore* pstore, const GUID* type, const GUID* subtype) { | 215 void ClearPStoreType(IPStore* pstore, const GUID* type, const GUID* subtype) { |
| 216 base::win::ScopedComPtr<IEnumPStoreItems, NULL> item; | 216 base::win::ScopedComPtr<IEnumPStoreItems, NULL> item; |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 491 path.AppendASCII("\x0061").Append(L"\x4E2D\x6587.url"), | 491 path.AppendASCII("\x0061").Append(L"\x4E2D\x6587.url"), |
| 492 L"http://chinese-title-favorite/", | 492 L"http://chinese-title-favorite/", |
| 493 L"http://example.com/favicon.ico")); | 493 L"http://example.com/favicon.ico")); |
| 494 ASSERT_TRUE(CreateUrlFile(links_path.AppendASCII("TheLink.url"), | 494 ASSERT_TRUE(CreateUrlFile(links_path.AppendASCII("TheLink.url"), |
| 495 L"http://www.links-thelink.com/")); | 495 L"http://www.links-thelink.com/")); |
| 496 ASSERT_TRUE(CreateUrlFile( | 496 ASSERT_TRUE(CreateUrlFile( |
| 497 links_path.AppendASCII("SubFolderOfLinks").AppendASCII("SubLink.url"), | 497 links_path.AppendASCII("SubFolderOfLinks").AppendASCII("SubLink.url"), |
| 498 L"http://www.links-sublink.com/")); | 498 L"http://www.links-sublink.com/")); |
| 499 ASSERT_TRUE(CreateUrlFile(path.AppendASCII("IEDefaultLink.url"), | 499 ASSERT_TRUE(CreateUrlFile(path.AppendASCII("IEDefaultLink.url"), |
| 500 L"http://go.microsoft.com/fwlink/?linkid=140813")); | 500 L"http://go.microsoft.com/fwlink/?linkid=140813")); |
| 501 file_util::WriteFile(path.AppendASCII("InvalidUrlFile.url"), "x", 1); | 501 base::WriteFile(path.AppendASCII("InvalidUrlFile.url"), "x", 1); |
| 502 file_util::WriteFile(path.AppendASCII("PlainTextFile.txt"), "x", 1); | 502 base::WriteFile(path.AppendASCII("PlainTextFile.txt"), "x", 1); |
| 503 | 503 |
| 504 const base::char16* root_links[] = { | 504 const base::char16* root_links[] = { |
| 505 L"Links", | 505 L"Links", |
| 506 L"Google Home Page.url", | 506 L"Google Home Page.url", |
| 507 L"TheLink.url", | 507 L"TheLink.url", |
| 508 L"SubFolder", | 508 L"SubFolder", |
| 509 L"WithPortAndQuery.url", | 509 L"WithPortAndQuery.url", |
| 510 L"a", | 510 L"a", |
| 511 L"SubFolder.url", | 511 L"SubFolder.url", |
| 512 }; | 512 }; |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 668 source_profile.source_path = temp_dir_.path(); | 668 source_profile.source_path = temp_dir_.path(); |
| 669 | 669 |
| 670 host->StartImportSettings( | 670 host->StartImportSettings( |
| 671 source_profile, | 671 source_profile, |
| 672 browser()->profile(), | 672 browser()->profile(), |
| 673 importer::HOME_PAGE, | 673 importer::HOME_PAGE, |
| 674 observer); | 674 observer); |
| 675 base::MessageLoop::current()->Run(); | 675 base::MessageLoop::current()->Run(); |
| 676 } | 676 } |
| 677 | 677 |
| OLD | NEW |