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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 result = locator->SetURL(url.c_str(), 0); | 181 result = locator->SetURL(url.c_str(), 0); |
182 if (FAILED(result)) | 182 if (FAILED(result)) |
183 return false; | 183 return false; |
184 | 184 |
185 // Write favicon url if specified. | 185 // Write favicon url if specified. |
186 if (!favicon_url.empty()) { | 186 if (!favicon_url.empty()) { |
187 base::win::ScopedComPtr<IPropertySetStorage> property_set_storage; | 187 base::win::ScopedComPtr<IPropertySetStorage> property_set_storage; |
188 if (FAILED(property_set_storage.QueryFrom(locator.Get()))) | 188 if (FAILED(property_set_storage.QueryFrom(locator.Get()))) |
189 return false; | 189 return false; |
190 base::win::ScopedComPtr<IPropertyStorage> property_storage; | 190 base::win::ScopedComPtr<IPropertyStorage> property_storage; |
191 if (FAILED(property_set_storage->Open(FMTID_Intshcut, | 191 if (FAILED(property_set_storage->Open(FMTID_Intshcut, STGM_WRITE, |
192 STGM_WRITE, | 192 property_storage.GetAddressOf()))) { |
193 property_storage.Receive()))) { | |
194 return false; | 193 return false; |
195 } | 194 } |
196 PROPSPEC properties[] = {{PRSPEC_PROPID, {PID_IS_ICONFILE}}}; | 195 PROPSPEC properties[] = {{PRSPEC_PROPID, {PID_IS_ICONFILE}}}; |
197 // WriteMultiple takes an array of PROPVARIANTs, but since this code only | 196 // WriteMultiple takes an array of PROPVARIANTs, but since this code only |
198 // 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. |
199 base::win::ScopedPropVariant pv_icon; | 198 base::win::ScopedPropVariant pv_icon; |
200 if (FAILED(InitPropVariantFromString(favicon_url.c_str(), | 199 if (FAILED(InitPropVariantFromString(favicon_url.c_str(), |
201 pv_icon.Receive())) || | 200 pv_icon.Receive())) || |
202 FAILED( | 201 FAILED( |
203 property_storage->WriteMultiple(1, properties, pv_icon.ptr(), 0))) { | 202 property_storage->WriteMultiple(1, properties, pv_icon.ptr(), 0))) { |
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
643 source_profile.source_path = temp_dir_.GetPath(); | 642 source_profile.source_path = temp_dir_.GetPath(); |
644 | 643 |
645 host->StartImportSettings( | 644 host->StartImportSettings( |
646 source_profile, | 645 source_profile, |
647 browser()->profile(), | 646 browser()->profile(), |
648 importer::HOME_PAGE, | 647 importer::HOME_PAGE, |
649 observer); | 648 observer); |
650 base::RunLoop().Run(); | 649 base::RunLoop().Run(); |
651 } | 650 } |
652 | 651 |
OLD | NEW |