| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/jumplist_win.h" | 5 #include "chrome/browser/jumplist_win.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 // Commit this transaction and send the updated JumpList to Windows. | 179 // Commit this transaction and send the updated JumpList to Windows. |
| 180 if (!jumplist_updater.CommitUpdate()) | 180 if (!jumplist_updater.CommitUpdate()) |
| 181 return false; | 181 return false; |
| 182 | 182 |
| 183 return true; | 183 return true; |
| 184 } | 184 } |
| 185 | 185 |
| 186 } // namespace | 186 } // namespace |
| 187 | 187 |
| 188 JumpList::JumpList(Profile* profile) | 188 JumpList::JumpList(Profile* profile) |
| 189 : weak_ptr_factory_(this), | 189 : profile_(profile), |
| 190 profile_(profile), | 190 task_id_(base::CancelableTaskTracker::kBadTaskId), |
| 191 task_id_(base::CancelableTaskTracker::kBadTaskId) { | 191 weak_ptr_factory_(this) { |
| 192 DCHECK(Enabled()); | 192 DCHECK(Enabled()); |
| 193 // To update JumpList when a tab is added or removed, we add this object to | 193 // To update JumpList when a tab is added or removed, we add this object to |
| 194 // the observer list of the TabRestoreService class. | 194 // the observer list of the TabRestoreService class. |
| 195 // When we add this object to the observer list, we save the pointer to this | 195 // When we add this object to the observer list, we save the pointer to this |
| 196 // TabRestoreService object. This pointer is used when we remove this object | 196 // TabRestoreService object. This pointer is used when we remove this object |
| 197 // from the observer list. | 197 // from the observer list. |
| 198 TabRestoreService* tab_restore_service = | 198 TabRestoreService* tab_restore_service = |
| 199 TabRestoreServiceFactory::GetForProfile(profile_); | 199 TabRestoreServiceFactory::GetForProfile(profile_); |
| 200 if (!tab_restore_service) | 200 if (!tab_restore_service) |
| 201 return; | 201 return; |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 496 } | 496 } |
| 497 | 497 |
| 498 void JumpList::CreateIconFiles(const ShellLinkItemList& item_list) { | 498 void JumpList::CreateIconFiles(const ShellLinkItemList& item_list) { |
| 499 for (ShellLinkItemList::const_iterator item = item_list.begin(); | 499 for (ShellLinkItemList::const_iterator item = item_list.begin(); |
| 500 item != item_list.end(); ++item) { | 500 item != item_list.end(); ++item) { |
| 501 base::FilePath icon_path; | 501 base::FilePath icon_path; |
| 502 if (CreateIconFile((*item)->icon_data(), icon_dir_, &icon_path)) | 502 if (CreateIconFile((*item)->icon_data(), icon_dir_, &icon_path)) |
| 503 (*item)->set_icon(icon_path.value(), 0); | 503 (*item)->set_icon(icon_path.value(), 0); |
| 504 } | 504 } |
| 505 } | 505 } |
| OLD | NEW |