| 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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 | 167 |
| 168 bool CreateUrlFileWithFavicon(const base::FilePath& file, | 168 bool CreateUrlFileWithFavicon(const base::FilePath& file, |
| 169 const base::string16& url, | 169 const base::string16& url, |
| 170 const base::string16& favicon_url) { | 170 const base::string16& favicon_url) { |
| 171 base::win::ScopedComPtr<IUniformResourceLocator> locator; | 171 base::win::ScopedComPtr<IUniformResourceLocator> locator; |
| 172 HRESULT result = locator.CreateInstance(CLSID_InternetShortcut, NULL, | 172 HRESULT result = locator.CreateInstance(CLSID_InternetShortcut, NULL, |
| 173 CLSCTX_INPROC_SERVER); | 173 CLSCTX_INPROC_SERVER); |
| 174 if (FAILED(result)) | 174 if (FAILED(result)) |
| 175 return false; | 175 return false; |
| 176 base::win::ScopedComPtr<IPersistFile> persist_file; | 176 base::win::ScopedComPtr<IPersistFile> persist_file; |
| 177 result = persist_file.QueryFrom(locator.get()); | 177 result = persist_file.QueryFrom(locator.Get()); |
| 178 if (FAILED(result)) | 178 if (FAILED(result)) |
| 179 return false; | 179 return false; |
| 180 result = locator->SetURL(url.c_str(), 0); | 180 result = locator->SetURL(url.c_str(), 0); |
| 181 if (FAILED(result)) | 181 if (FAILED(result)) |
| 182 return false; | 182 return false; |
| 183 | 183 |
| 184 // Write favicon url if specified. | 184 // Write favicon url if specified. |
| 185 if (!favicon_url.empty()) { | 185 if (!favicon_url.empty()) { |
| 186 base::win::ScopedComPtr<IPropertySetStorage> property_set_storage; | 186 base::win::ScopedComPtr<IPropertySetStorage> property_set_storage; |
| 187 if (FAILED(property_set_storage.QueryFrom(locator.get()))) | 187 if (FAILED(property_set_storage.QueryFrom(locator.Get()))) |
| 188 return false; | 188 return false; |
| 189 base::win::ScopedComPtr<IPropertyStorage> property_storage; | 189 base::win::ScopedComPtr<IPropertyStorage> property_storage; |
| 190 if (FAILED(property_set_storage->Open(FMTID_Intshcut, | 190 if (FAILED(property_set_storage->Open(FMTID_Intshcut, |
| 191 STGM_WRITE, | 191 STGM_WRITE, |
| 192 property_storage.Receive()))) { | 192 property_storage.Receive()))) { |
| 193 return false; | 193 return false; |
| 194 } | 194 } |
| 195 PROPSPEC properties[] = {{PRSPEC_PROPID, {PID_IS_ICONFILE}}}; | 195 PROPSPEC properties[] = {{PRSPEC_PROPID, {PID_IS_ICONFILE}}}; |
| 196 // WriteMultiple takes an array of PROPVARIANTs, but since this code only | 196 // WriteMultiple takes an array of PROPVARIANTs, but since this code only |
| 197 // needs an array of size 1: a pointer to |pv_icon| is equivalent. | 197 // needs an array of size 1: a pointer to |pv_icon| is equivalent. |
| (...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 641 source_profile.source_path = temp_dir_.GetPath(); | 641 source_profile.source_path = temp_dir_.GetPath(); |
| 642 | 642 |
| 643 host->StartImportSettings( | 643 host->StartImportSettings( |
| 644 source_profile, | 644 source_profile, |
| 645 browser()->profile(), | 645 browser()->profile(), |
| 646 importer::HOME_PAGE, | 646 importer::HOME_PAGE, |
| 647 observer); | 647 observer); |
| 648 base::RunLoop().Run(); | 648 base::RunLoop().Run(); |
| 649 } | 649 } |
| 650 | 650 |
| OLD | NEW |