OLD | NEW |
---|---|
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/win/jumplist.h" | 5 #include "chrome/browser/win/jumplist.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
270 // Make sure we are not out of date: if icon_urls_ is not empty, then | 270 // Make sure we are not out of date: if icon_urls_ is not empty, then |
271 // another notification has been received since we processed this one | 271 // another notification has been received since we processed this one |
272 if (!data->icon_urls_.empty()) | 272 if (!data->icon_urls_.empty()) |
273 return; | 273 return; |
274 | 274 |
275 // Make local copies of lists so we can release the lock. | 275 // Make local copies of lists so we can release the lock. |
276 local_most_visited_pages = data->most_visited_pages_; | 276 local_most_visited_pages = data->most_visited_pages_; |
277 local_recently_closed_pages = data->recently_closed_pages_; | 277 local_recently_closed_pages = data->recently_closed_pages_; |
278 } | 278 } |
279 | 279 |
280 // Delete the content in JumpListIcons folder and log the results to UMA. | |
281 DeleteDirectoryContentAndLogResults(icon_dir, kFileDeleteLimit); | |
282 | |
280 // Create a new JumpList and replace the current JumpList with it. The | 283 // Create a new JumpList and replace the current JumpList with it. The |
281 // jumplist links are updated anyway, while the jumplist icons may not as | 284 // jumplist links are updated anyway, while the jumplist icons may not as |
282 // mentioned above. | 285 // mentioned above. |
283 UpdateJumpList(app_id.c_str(), icon_dir, local_most_visited_pages, | 286 UpdateJumpList(app_id.c_str(), icon_dir, local_most_visited_pages, |
284 local_recently_closed_pages, incognito_availability); | 287 local_recently_closed_pages, incognito_availability); |
285 } | 288 } |
286 | 289 |
287 } // namespace | 290 } // namespace |
288 | 291 |
289 JumpList::JumpListData::JumpListData() {} | 292 JumpList::JumpListData::JumpListData() {} |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
599 | 602 |
600 void JumpList::DeferredRunUpdate() { | 603 void JumpList::DeferredRunUpdate() { |
601 DCHECK(CalledOnValidThread()); | 604 DCHECK(CalledOnValidThread()); |
602 | 605 |
603 TRACE_EVENT0("browser", "JumpList::DeferredRunUpdate"); | 606 TRACE_EVENT0("browser", "JumpList::DeferredRunUpdate"); |
604 // Check if incognito windows (or normal windows) are disabled by policy. | 607 // Check if incognito windows (or normal windows) are disabled by policy. |
605 IncognitoModePrefs::Availability incognito_availability = | 608 IncognitoModePrefs::Availability incognito_availability = |
606 profile_ ? IncognitoModePrefs::GetAvailability(profile_->GetPrefs()) | 609 profile_ ? IncognitoModePrefs::GetAvailability(profile_->GetPrefs()) |
607 : IncognitoModePrefs::ENABLED; | 610 : IncognitoModePrefs::ENABLED; |
608 | 611 |
609 // Post a task to delete the content in JumpListIcons folder and log the | 612 // Post a task to update the jumplist in JumpListIcons folder, which consists |
610 // results to UMA. | 613 // of 1) delete old icons, 2) create new icons, 3) notigfy the OS. |
Patrick Monette
2017/04/18 01:58:32
s/notigfy/notify
chengx
2017/04/18 02:13:40
Done.
| |
611 update_jumplisticons_task_runner_->PostTask( | |
612 FROM_HERE, base::Bind(&DeleteDirectoryContentAndLogResults, icon_dir_, | |
613 kFileDeleteLimit)); | |
614 | |
615 // Post a task to update the jumplist used by the shell. | |
616 update_jumplisticons_task_runner_->PostTask( | 614 update_jumplisticons_task_runner_->PostTask( |
617 FROM_HERE, base::Bind(&RunUpdateJumpList, incognito_availability, app_id_, | 615 FROM_HERE, base::Bind(&RunUpdateJumpList, incognito_availability, app_id_, |
618 icon_dir_, base::RetainedRef(jumplist_data_))); | 616 icon_dir_, base::RetainedRef(jumplist_data_))); |
619 | 617 |
620 // Post a task to delete JumpListIconsOld folder and log the results to UMA. | 618 // Post a task to delete JumpListIconsOld folder and log the results to UMA. |
621 base::FilePath icon_dir_old = icon_dir_.DirName().Append( | 619 base::FilePath icon_dir_old = icon_dir_.DirName().Append( |
622 icon_dir_.BaseName().value() + FILE_PATH_LITERAL("Old")); | 620 icon_dir_.BaseName().value() + FILE_PATH_LITERAL("Old")); |
623 | 621 |
624 delete_jumplisticonsold_task_runner_->PostTask( | 622 delete_jumplisticonsold_task_runner_->PostTask( |
625 FROM_HERE, base::Bind(&DeleteDirectoryAndLogResults, | 623 FROM_HERE, base::Bind(&DeleteDirectoryAndLogResults, |
626 std::move(icon_dir_old), kFileDeleteLimit)); | 624 std::move(icon_dir_old), kFileDeleteLimit)); |
627 } | 625 } |
628 | 626 |
629 void JumpList::TopSitesLoaded(history::TopSites* top_sites) { | 627 void JumpList::TopSitesLoaded(history::TopSites* top_sites) { |
630 } | 628 } |
631 | 629 |
632 void JumpList::TopSitesChanged(history::TopSites* top_sites, | 630 void JumpList::TopSitesChanged(history::TopSites* top_sites, |
633 ChangeReason change_reason) { | 631 ChangeReason change_reason) { |
634 top_sites->GetMostVisitedURLs( | 632 top_sites->GetMostVisitedURLs( |
635 base::Bind(&JumpList::OnMostVisitedURLsAvailable, | 633 base::Bind(&JumpList::OnMostVisitedURLsAvailable, |
636 weak_ptr_factory_.GetWeakPtr()), | 634 weak_ptr_factory_.GetWeakPtr()), |
637 false); | 635 false); |
638 } | 636 } |
OLD | NEW |