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

Side by Side Diff: chrome/browser/win/jumplist_updater.cc

Issue 2864523002: Rename ScopedComPtr::QueryInterface to ScopedComPtr::CopyTo (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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/win/jumplist_updater.h" 5 #include "chrome/browser/win/jumplist_updater.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <objbase.h> 8 #include <objbase.h>
9 #include <propkey.h> 9 #include <propkey.h>
10 #include <shobjidl.h> 10 #include <shobjidl.h>
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 // have to exit even when it fails. 56 // have to exit even when it fails.
57 if (!item->icon_path().empty()) 57 if (!item->icon_path().empty())
58 link->SetIconLocation(item->icon_path().c_str(), item->icon_index()); 58 link->SetIconLocation(item->icon_path().c_str(), item->icon_index());
59 59
60 // Set the title of the IShellLink object. 60 // Set the title of the IShellLink object.
61 // The IShellLink interface does not have any functions which update its 61 // The IShellLink interface does not have any functions which update its
62 // title because this interface is originally for creating an application 62 // title because this interface is originally for creating an application
63 // shortcut which doesn't have titles. 63 // shortcut which doesn't have titles.
64 // So, we should use the IPropertyStore interface to set its title. 64 // So, we should use the IPropertyStore interface to set its title.
65 base::win::ScopedComPtr<IPropertyStore> property_store; 65 base::win::ScopedComPtr<IPropertyStore> property_store;
66 result = link.QueryInterface(property_store.Receive()); 66 result = link.CopyTo(property_store.Receive());
67 if (FAILED(result)) 67 if (FAILED(result))
68 return false; 68 return false;
69 69
70 if (!base::win::SetStringValueForPropertyStore( 70 if (!base::win::SetStringValueForPropertyStore(
71 property_store.Get(), 71 property_store.Get(),
72 PKEY_Title, 72 PKEY_Title,
73 item->title().c_str())) { 73 item->title().c_str())) {
74 return false; 74 return false;
75 } 75 }
76 76
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 it != link_items.end(); ++it) { 189 it != link_items.end(); ++it) {
190 if (!AddShellLink(collection, application_path.value(), *it)) 190 if (!AddShellLink(collection, application_path.value(), *it))
191 return false; 191 return false;
192 } 192 }
193 193
194 // We can now add the new list to the JumpList. 194 // We can now add the new list to the JumpList.
195 // ICustomDestinationList::AddUserTasks() also uses the IObjectArray 195 // ICustomDestinationList::AddUserTasks() also uses the IObjectArray
196 // interface to retrieve each item in the list. So, we retrieve the 196 // interface to retrieve each item in the list. So, we retrieve the
197 // IObjectArray interface from the EnumerableObjectCollection object. 197 // IObjectArray interface from the EnumerableObjectCollection object.
198 base::win::ScopedComPtr<IObjectArray> object_array; 198 base::win::ScopedComPtr<IObjectArray> object_array;
199 result = collection.QueryInterface(object_array.Receive()); 199 result = collection.CopyTo(object_array.Receive());
200 if (FAILED(result)) 200 if (FAILED(result))
201 return false; 201 return false;
202 202
203 return SUCCEEDED(destination_list_->AddUserTasks(object_array.Get())); 203 return SUCCEEDED(destination_list_->AddUserTasks(object_array.Get()));
204 } 204 }
205 205
206 bool JumpListUpdater::AddCustomCategory(const std::wstring& category_name, 206 bool JumpListUpdater::AddCustomCategory(const std::wstring& category_name,
207 const ShellLinkItemList& link_items, 207 const ShellLinkItemList& link_items,
208 size_t max_items) { 208 size_t max_items) {
209 // TODO(chengx): Remove the UMA histogram after fixing http://crbug.com/40407. 209 // TODO(chengx): Remove the UMA histogram after fixing http://crbug.com/40407.
(...skipping 29 matching lines...) Expand all
239 } 239 }
240 240
241 // We can now add the new list to the JumpList. 241 // We can now add the new list to the JumpList.
242 // The ICustomDestinationList::AppendCategory() function needs the 242 // The ICustomDestinationList::AppendCategory() function needs the
243 // IObjectArray interface to retrieve each item in the list. So, we retrive 243 // IObjectArray interface to retrieve each item in the list. So, we retrive
244 // the IObjectArray interface from the IEnumerableObjectCollection object 244 // the IObjectArray interface from the IEnumerableObjectCollection object
245 // and use it. 245 // and use it.
246 // It seems the ICustomDestinationList::AppendCategory() function just 246 // It seems the ICustomDestinationList::AppendCategory() function just
247 // replaces all items in the given category with the ones in the new list. 247 // replaces all items in the given category with the ones in the new list.
248 base::win::ScopedComPtr<IObjectArray> object_array; 248 base::win::ScopedComPtr<IObjectArray> object_array;
249 result = collection.QueryInterface(object_array.Receive()); 249 result = collection.CopyTo(object_array.Receive());
250 if (FAILED(result)) 250 if (FAILED(result))
251 return false; 251 return false;
252 252
253 return SUCCEEDED(destination_list_->AppendCategory(category_name.c_str(), 253 return SUCCEEDED(destination_list_->AppendCategory(category_name.c_str(),
254 object_array.Get())); 254 object_array.Get()));
255 } 255 }
OLDNEW
« no previous file with comments | « chrome/browser/google/google_update_win.cc ('k') | content/browser/accessibility/accessibility_event_recorder_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698