OLD | NEW |
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 <propkey.h> | 9 #include <propkey.h> |
9 #include <shobjidl.h> | 10 #include <shobjidl.h> |
10 | 11 |
11 #include "base/command_line.h" | 12 #include "base/command_line.h" |
12 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
13 #include "base/metrics/histogram_macros.h" | 14 #include "base/metrics/histogram_macros.h" |
14 #include "base/path_service.h" | 15 #include "base/path_service.h" |
15 #include "base/win/win_util.h" | 16 #include "base/win/win_util.h" |
16 #include "base/win/windows_version.h" | 17 #include "base/win/windows_version.h" |
17 #include "chrome/common/chrome_switches.h" | 18 #include "chrome/common/chrome_switches.h" |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 if (FAILED(result)) | 140 if (FAILED(result)) |
140 return false; | 141 return false; |
141 | 142 |
142 // Start a transaction that updates the JumpList of this application. | 143 // Start a transaction that updates the JumpList of this application. |
143 // This implementation just replaces the all items in this JumpList, so | 144 // This implementation just replaces the all items in this JumpList, so |
144 // we don't have to use the IObjectArray object returned from this call. | 145 // we don't have to use the IObjectArray object returned from this call. |
145 // It seems Windows 7 RC (Build 7100) automatically checks the items in this | 146 // It seems Windows 7 RC (Build 7100) automatically checks the items in this |
146 // removed list and prevent us from adding the same item. | 147 // removed list and prevent us from adding the same item. |
147 UINT max_slots; | 148 UINT max_slots; |
148 base::win::ScopedComPtr<IObjectArray> removed; | 149 base::win::ScopedComPtr<IObjectArray> removed; |
149 result = destination_list_->BeginList(&max_slots, __uuidof(*removed), | 150 result = destination_list_->BeginList(&max_slots, IID_PPV_ARGS(&removed)); |
150 removed.ReceiveVoid()); | |
151 if (FAILED(result)) | 151 if (FAILED(result)) |
152 return false; | 152 return false; |
153 | 153 |
154 user_max_items_ = max_slots; | 154 user_max_items_ = max_slots; |
155 | 155 |
156 return true; | 156 return true; |
157 } | 157 } |
158 | 158 |
159 bool JumpListUpdater::CommitUpdate() { | 159 bool JumpListUpdater::CommitUpdate() { |
160 // TODO(chengx): Remove the UMA histogram after fixing http://crbug.com/40407. | 160 // TODO(chengx): Remove the UMA histogram after fixing http://crbug.com/40407. |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 // It seems the ICustomDestinationList::AppendCategory() function just | 249 // It seems the ICustomDestinationList::AppendCategory() function just |
250 // replaces all items in the given category with the ones in the new list. | 250 // replaces all items in the given category with the ones in the new list. |
251 base::win::ScopedComPtr<IObjectArray> object_array; | 251 base::win::ScopedComPtr<IObjectArray> object_array; |
252 result = collection.QueryInterface(object_array.Receive()); | 252 result = collection.QueryInterface(object_array.Receive()); |
253 if (FAILED(result)) | 253 if (FAILED(result)) |
254 return false; | 254 return false; |
255 | 255 |
256 return SUCCEEDED(destination_list_->AppendCategory(category_name.c_str(), | 256 return SUCCEEDED(destination_list_->AppendCategory(category_name.c_str(), |
257 object_array.Get())); | 257 object_array.Get())); |
258 } | 258 } |
OLD | NEW |