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

Side by Side Diff: chrome/browser/jumplist_win.cc

Issue 137263007: Move CancelableTaskTracker to //base/task/CancelableTaskTracker. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move to base/task/cancelable_task_tracker* Created 6 years, 10 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 (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 <windows.h> 7 #include <windows.h>
8 #include <shobjidl.h> 8 #include <shobjidl.h>
9 #include <propkey.h> 9 #include <propkey.h>
10 #include <propvarutil.h> 10 #include <propvarutil.h>
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 return false; 459 return false;
460 460
461 return true; 461 return true;
462 } 462 }
463 463
464 } // namespace 464 } // namespace
465 465
466 JumpList::JumpList() 466 JumpList::JumpList()
467 : weak_ptr_factory_(this), 467 : weak_ptr_factory_(this),
468 profile_(NULL), 468 profile_(NULL),
469 task_id_(CancelableTaskTracker::kBadTaskId) { 469 task_id_(base::CancelableTaskTracker::kBadTaskId) {}
470 }
471 470
472 JumpList::~JumpList() { 471 JumpList::~JumpList() {
473 Terminate(); 472 Terminate();
474 } 473 }
475 474
476 // static 475 // static
477 bool JumpList::Enabled() { 476 bool JumpList::Enabled() {
478 return (base::win::GetVersion() >= base::win::VERSION_WIN7 && 477 return (base::win::GetVersion() >= base::win::VERSION_WIN7 &&
479 !CommandLine::ForCurrentProcess()->HasSwitch( 478 !CommandLine::ForCurrentProcess()->HasSwitch(
480 switches::kDisableCustomJumpList)); 479 switches::kDisableCustomJumpList));
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 TabRestoreService* tab_restore_service = 545 TabRestoreService* tab_restore_service =
547 TabRestoreServiceFactory::GetForProfile(profile_); 546 TabRestoreServiceFactory::GetForProfile(profile_);
548 if (tab_restore_service) 547 if (tab_restore_service)
549 tab_restore_service->RemoveObserver(this); 548 tab_restore_service->RemoveObserver(this);
550 registrar_.reset(); 549 registrar_.reset();
551 } 550 }
552 profile_ = NULL; 551 profile_ = NULL;
553 } 552 }
554 553
555 void JumpList::CancelPendingUpdate() { 554 void JumpList::CancelPendingUpdate() {
556 if (task_id_ != CancelableTaskTracker::kBadTaskId) { 555 if (task_id_ != base::CancelableTaskTracker::kBadTaskId) {
557 cancelable_task_tracker_.TryCancel(task_id_); 556 cancelable_task_tracker_.TryCancel(task_id_);
558 task_id_ = CancelableTaskTracker::kBadTaskId; 557 task_id_ = base::CancelableTaskTracker::kBadTaskId;
559 } 558 }
560 } 559 }
561 560
562 void JumpList::Terminate() { 561 void JumpList::Terminate() {
563 CancelPendingUpdate(); 562 CancelPendingUpdate();
564 RemoveObserver(); 563 RemoveObserver();
565 } 564 }
566 565
567 void JumpList::OnMostVisitedURLsAvailable( 566 void JumpList::OnMostVisitedURLsAvailable(
568 const history::MostVisitedURLList& data) { 567 const history::MostVisitedURLList& data) {
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
690 gfx::kFaviconSize), 689 gfx::kFaviconSize),
691 base::Bind(&JumpList::OnFaviconDataAvailable, 690 base::Bind(&JumpList::OnFaviconDataAvailable,
692 base::Unretained(this)), 691 base::Unretained(this)),
693 &cancelable_task_tracker_); 692 &cancelable_task_tracker_);
694 } 693 }
695 694
696 void JumpList::OnFaviconDataAvailable( 695 void JumpList::OnFaviconDataAvailable(
697 const chrome::FaviconImageResult& image_result) { 696 const chrome::FaviconImageResult& image_result) {
698 // If there is currently a favicon request in progress, it is now outdated, 697 // If there is currently a favicon request in progress, it is now outdated,
699 // as we have received another, so nullify the handle from the old request. 698 // as we have received another, so nullify the handle from the old request.
700 task_id_ = CancelableTaskTracker::kBadTaskId; 699 task_id_ = base::CancelableTaskTracker::kBadTaskId;
701 // lock the list to set icon data and pop the url 700 // lock the list to set icon data and pop the url
702 { 701 {
703 base::AutoLock auto_lock(list_lock_); 702 base::AutoLock auto_lock(list_lock_);
704 // Attach the received data to the ShellLinkItem object. 703 // Attach the received data to the ShellLinkItem object.
705 // This data will be decoded by the RunUpdate method. 704 // This data will be decoded by the RunUpdate method.
706 if (!image_result.image.IsEmpty()) { 705 if (!image_result.image.IsEmpty()) {
707 if (!icon_urls_.empty() && icon_urls_.front().second) 706 if (!icon_urls_.empty() && icon_urls_.front().second)
708 icon_urls_.front().second->SetIconData(image_result.image.AsBitmap()); 707 icon_urls_.front().second->SetIconData(image_result.image.AsBitmap());
709 } 708 }
710 709
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
755 } 754 }
756 755
757 void JumpList::CreateIconFiles(const ShellLinkItemList& item_list) { 756 void JumpList::CreateIconFiles(const ShellLinkItemList& item_list) {
758 for (ShellLinkItemList::const_iterator item = item_list.begin(); 757 for (ShellLinkItemList::const_iterator item = item_list.begin();
759 item != item_list.end(); ++item) { 758 item != item_list.end(); ++item) {
760 base::FilePath icon_path; 759 base::FilePath icon_path;
761 if (CreateIconFile((*item)->data(), icon_dir_, &icon_path)) 760 if (CreateIconFile((*item)->data(), icon_dir_, &icon_path))
762 (*item)->SetIcon(icon_path.value(), 0, true); 761 (*item)->SetIcon(icon_path.value(), 0, true);
763 } 762 }
764 } 763 }
OLDNEW
« no previous file with comments | « chrome/browser/jumplist_win.h ('k') | chrome/browser/notifications/message_center_settings_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698