Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(330)

Side by Side Diff: chrome/browser/importer/ie_importer_browsertest_win.cc

Issue 2885063003: Remove ScopedComPtr::QueryFrom() (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « base/win/shortcut.cc ('k') | chrome/browser/shell_integration_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 168
169 bool CreateUrlFileWithFavicon(const base::FilePath& file, 169 bool CreateUrlFileWithFavicon(const base::FilePath& file,
170 const base::string16& url, 170 const base::string16& url,
171 const base::string16& favicon_url) { 171 const base::string16& favicon_url) {
172 base::win::ScopedComPtr<IUniformResourceLocator> locator; 172 base::win::ScopedComPtr<IUniformResourceLocator> locator;
173 HRESULT result = locator.CreateInstance(CLSID_InternetShortcut, NULL, 173 HRESULT result = locator.CreateInstance(CLSID_InternetShortcut, NULL,
174 CLSCTX_INPROC_SERVER); 174 CLSCTX_INPROC_SERVER);
175 if (FAILED(result)) 175 if (FAILED(result))
176 return false; 176 return false;
177 base::win::ScopedComPtr<IPersistFile> persist_file; 177 base::win::ScopedComPtr<IPersistFile> persist_file;
178 result = persist_file.QueryFrom(locator.Get()); 178 result = locator.CopyTo(persist_file.GetAddressOf());
179 if (FAILED(result)) 179 if (FAILED(result))
180 return false; 180 return false;
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(locator.CopyTo(property_set_storage.GetAddressOf())))
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, STGM_WRITE, 191 if (FAILED(property_set_storage->Open(FMTID_Intshcut, STGM_WRITE,
192 property_storage.GetAddressOf()))) { 192 property_storage.GetAddressOf()))) {
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.
198 base::win::ScopedPropVariant pv_icon; 198 base::win::ScopedPropVariant pv_icon;
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
642 source_profile.source_path = temp_dir_.GetPath(); 642 source_profile.source_path = temp_dir_.GetPath();
643 643
644 host->StartImportSettings( 644 host->StartImportSettings(
645 source_profile, 645 source_profile,
646 browser()->profile(), 646 browser()->profile(),
647 importer::HOME_PAGE, 647 importer::HOME_PAGE,
648 observer); 648 observer);
649 base::RunLoop().Run(); 649 base::RunLoop().Run();
650 } 650 }
651 651
OLDNEW
« no previous file with comments | « base/win/shortcut.cc ('k') | chrome/browser/shell_integration_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698