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

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

Issue 2870263002: Rename ScopedComPtr::Receive to ScopedComPtr::GetAddressOf (Closed)
Patch Set: Rebase to 2a6f440 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.CopyTo(property_store.Receive()); 66 result = link.CopyTo(property_store.GetAddressOf());
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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 it != link_items.end(); ++it) { 187 it != link_items.end(); ++it) {
188 if (!AddShellLink(collection, application_path.value(), *it)) 188 if (!AddShellLink(collection, application_path.value(), *it))
189 return false; 189 return false;
190 } 190 }
191 191
192 // We can now add the new list to the JumpList. 192 // We can now add the new list to the JumpList.
193 // ICustomDestinationList::AddUserTasks() also uses the IObjectArray 193 // ICustomDestinationList::AddUserTasks() also uses the IObjectArray
194 // interface to retrieve each item in the list. So, we retrieve the 194 // interface to retrieve each item in the list. So, we retrieve the
195 // IObjectArray interface from the EnumerableObjectCollection object. 195 // IObjectArray interface from the EnumerableObjectCollection object.
196 base::win::ScopedComPtr<IObjectArray> object_array; 196 base::win::ScopedComPtr<IObjectArray> object_array;
197 result = collection.CopyTo(object_array.Receive()); 197 result = collection.CopyTo(object_array.GetAddressOf());
198 if (FAILED(result)) 198 if (FAILED(result))
199 return false; 199 return false;
200 200
201 return SUCCEEDED(destination_list_->AddUserTasks(object_array.Get())); 201 return SUCCEEDED(destination_list_->AddUserTasks(object_array.Get()));
202 } 202 }
203 203
204 bool JumpListUpdater::AddCustomCategory(const base::string16& category_name, 204 bool JumpListUpdater::AddCustomCategory(const base::string16& category_name,
205 const ShellLinkItemList& link_items, 205 const ShellLinkItemList& link_items,
206 size_t max_items) { 206 size_t max_items) {
207 // TODO(chengx): Remove the UMA histogram after fixing http://crbug.com/40407. 207 // TODO(chengx): Remove the UMA histogram after fixing http://crbug.com/40407.
(...skipping 29 matching lines...) Expand all
237 } 237 }
238 238
239 // We can now add the new list to the JumpList. 239 // We can now add the new list to the JumpList.
240 // The ICustomDestinationList::AppendCategory() function needs the 240 // The ICustomDestinationList::AppendCategory() function needs the
241 // IObjectArray interface to retrieve each item in the list. So, we retrive 241 // IObjectArray interface to retrieve each item in the list. So, we retrive
242 // the IObjectArray interface from the IEnumerableObjectCollection object 242 // the IObjectArray interface from the IEnumerableObjectCollection object
243 // and use it. 243 // and use it.
244 // It seems the ICustomDestinationList::AppendCategory() function just 244 // It seems the ICustomDestinationList::AppendCategory() function just
245 // replaces all items in the given category with the ones in the new list. 245 // replaces all items in the given category with the ones in the new list.
246 base::win::ScopedComPtr<IObjectArray> object_array; 246 base::win::ScopedComPtr<IObjectArray> object_array;
247 result = collection.CopyTo(object_array.Receive()); 247 result = collection.CopyTo(object_array.GetAddressOf());
248 if (FAILED(result)) 248 if (FAILED(result))
249 return false; 249 return false;
250 250
251 return SUCCEEDED(destination_list_->AppendCategory(category_name.c_str(), 251 return SUCCEEDED(destination_list_->AppendCategory(category_name.c_str(),
252 object_array.Get())); 252 object_array.Get()));
253 } 253 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698