| 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 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 | 367 |
| 368 JumpList::JumpListData::~JumpListData() {} | 368 JumpList::JumpListData::~JumpListData() {} |
| 369 | 369 |
| 370 JumpList::JumpList(Profile* profile) | 370 JumpList::JumpList(Profile* profile) |
| 371 : RefcountedKeyedService(content::BrowserThread::GetTaskRunnerForThread( | 371 : RefcountedKeyedService(content::BrowserThread::GetTaskRunnerForThread( |
| 372 content::BrowserThread::UI)), | 372 content::BrowserThread::UI)), |
| 373 profile_(profile), | 373 profile_(profile), |
| 374 jumplist_data_(new base::RefCountedData<JumpListData>), | 374 jumplist_data_(new base::RefCountedData<JumpListData>), |
| 375 task_id_(base::CancelableTaskTracker::kBadTaskId), | 375 task_id_(base::CancelableTaskTracker::kBadTaskId), |
| 376 update_jumplist_task_runner_(base::CreateCOMSTATaskRunnerWithTraits( | 376 update_jumplist_task_runner_(base::CreateCOMSTATaskRunnerWithTraits( |
| 377 base::TaskTraits() | 377 {base::MayBlock(), base::TaskPriority::USER_VISIBLE, |
| 378 .WithPriority(base::TaskPriority::USER_VISIBLE) | 378 base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN})), |
| 379 .WithShutdownBehavior( | |
| 380 base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN) | |
| 381 .MayBlock())), | |
| 382 delete_jumplisticons_task_runner_( | 379 delete_jumplisticons_task_runner_( |
| 383 base::CreateSequencedTaskRunnerWithTraits( | 380 base::CreateSequencedTaskRunnerWithTraits( |
| 384 base::TaskTraits() | 381 {base::MayBlock(), base::TaskPriority::BACKGROUND, |
| 385 .WithPriority(base::TaskPriority::BACKGROUND) | 382 base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN})), |
| 386 .WithShutdownBehavior( | |
| 387 base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN) | |
| 388 .MayBlock())), | |
| 389 weak_ptr_factory_(this) { | 383 weak_ptr_factory_(this) { |
| 390 DCHECK(Enabled()); | 384 DCHECK(Enabled()); |
| 391 // To update JumpList when a tab is added or removed, we add this object to | 385 // To update JumpList when a tab is added or removed, we add this object to |
| 392 // the observer list of the TabRestoreService class. | 386 // the observer list of the TabRestoreService class. |
| 393 // When we add this object to the observer list, we save the pointer to this | 387 // When we add this object to the observer list, we save the pointer to this |
| 394 // TabRestoreService object. This pointer is used when we remove this object | 388 // TabRestoreService object. This pointer is used when we remove this object |
| 395 // from the observer list. | 389 // from the observer list. |
| 396 sessions::TabRestoreService* tab_restore_service = | 390 sessions::TabRestoreService* tab_restore_service = |
| 397 TabRestoreServiceFactory::GetForProfile(profile_); | 391 TabRestoreServiceFactory::GetForProfile(profile_); |
| 398 if (!tab_restore_service) | 392 if (!tab_restore_service) |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 704 void JumpList::TopSitesLoaded(history::TopSites* top_sites) { | 698 void JumpList::TopSitesLoaded(history::TopSites* top_sites) { |
| 705 } | 699 } |
| 706 | 700 |
| 707 void JumpList::TopSitesChanged(history::TopSites* top_sites, | 701 void JumpList::TopSitesChanged(history::TopSites* top_sites, |
| 708 ChangeReason change_reason) { | 702 ChangeReason change_reason) { |
| 709 top_sites->GetMostVisitedURLs( | 703 top_sites->GetMostVisitedURLs( |
| 710 base::Bind(&JumpList::OnMostVisitedURLsAvailable, | 704 base::Bind(&JumpList::OnMostVisitedURLsAvailable, |
| 711 weak_ptr_factory_.GetWeakPtr()), | 705 weak_ptr_factory_.GetWeakPtr()), |
| 712 false); | 706 false); |
| 713 } | 707 } |
| OLD | NEW |