| 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 "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 23 matching lines...) Expand all Loading... |
| 34 #include "components/history/core/browser/page_usage_data.h" | 34 #include "components/history/core/browser/page_usage_data.h" |
| 35 #include "components/history/core/browser/top_sites.h" | 35 #include "components/history/core/browser/top_sites.h" |
| 36 #include "components/prefs/pref_change_registrar.h" | 36 #include "components/prefs/pref_change_registrar.h" |
| 37 #include "components/sessions/core/session_types.h" | 37 #include "components/sessions/core/session_types.h" |
| 38 #include "components/sessions/core/tab_restore_service.h" | 38 #include "components/sessions/core/tab_restore_service.h" |
| 39 #include "components/strings/grit/components_strings.h" | 39 #include "components/strings/grit/components_strings.h" |
| 40 #include "content/public/browser/browser_thread.h" | 40 #include "content/public/browser/browser_thread.h" |
| 41 #include "content/public/browser/notification_registrar.h" | 41 #include "content/public/browser/notification_registrar.h" |
| 42 #include "content/public/browser/notification_source.h" | 42 #include "content/public/browser/notification_source.h" |
| 43 #include "ui/base/l10n/l10n_util.h" | 43 #include "ui/base/l10n/l10n_util.h" |
| 44 #include "ui/display/win/screen_win.h" |
| 44 #include "ui/gfx/codec/png_codec.h" | 45 #include "ui/gfx/codec/png_codec.h" |
| 45 #include "ui/gfx/favicon_size.h" | 46 #include "ui/gfx/favicon_size.h" |
| 46 #include "ui/gfx/icon_util.h" | 47 #include "ui/gfx/icon_util.h" |
| 47 #include "ui/gfx/image/image_family.h" | 48 #include "ui/gfx/image/image_family.h" |
| 48 #include "url/gurl.h" | 49 #include "url/gurl.h" |
| 49 | 50 |
| 50 using content::BrowserThread; | 51 using content::BrowserThread; |
| 51 using JumpListData = JumpList::JumpListData; | 52 using JumpListData = JumpList::JumpListData; |
| 52 | 53 |
| 53 namespace { | 54 namespace { |
| (...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 534 | 535 |
| 535 // If there is currently a favicon request in progress, it is now outdated, | 536 // If there is currently a favicon request in progress, it is now outdated, |
| 536 // as we have received another, so nullify the handle from the old request. | 537 // as we have received another, so nullify the handle from the old request. |
| 537 task_id_ = base::CancelableTaskTracker::kBadTaskId; | 538 task_id_ = base::CancelableTaskTracker::kBadTaskId; |
| 538 // Lock the list to set icon data and pop the url. | 539 // Lock the list to set icon data and pop the url. |
| 539 { | 540 { |
| 540 JumpListData* data = &jumplist_data_->data; | 541 JumpListData* data = &jumplist_data_->data; |
| 541 base::AutoLock auto_lock(data->list_lock_); | 542 base::AutoLock auto_lock(data->list_lock_); |
| 542 // Attach the received data to the ShellLinkItem object. | 543 // Attach the received data to the ShellLinkItem object. |
| 543 // This data will be decoded by the RunUpdateOnFileThread method. | 544 // This data will be decoded by the RunUpdateOnFileThread method. |
| 544 if (!image_result.image.IsEmpty()) { | 545 if (!image_result.image.IsEmpty() && !data->icon_urls_.empty() && |
| 545 if (!data->icon_urls_.empty() && data->icon_urls_.front().second.get()) | 546 data->icon_urls_.front().second.get()) { |
| 547 float scale = display::win::ScreenWin::GetLargestDeviceScaleFactor(); |
| 548 if (scale > 1.0) { |
| 549 data->icon_urls_.front().second->set_icon_data( |
| 550 image_result.image.AsBitmap2x()); |
| 551 } else { |
| 546 data->icon_urls_.front().second->set_icon_data( | 552 data->icon_urls_.front().second->set_icon_data( |
| 547 image_result.image.AsBitmap()); | 553 image_result.image.AsBitmap()); |
| 554 } |
| 548 } | 555 } |
| 549 | 556 |
| 550 if (!data->icon_urls_.empty()) | 557 if (!data->icon_urls_.empty()) |
| 551 data->icon_urls_.pop_front(); | 558 data->icon_urls_.pop_front(); |
| 552 } | 559 } |
| 553 // Check whether we need to load more favicons. | 560 // Check whether we need to load more favicons. |
| 554 StartLoadingFavicon(); | 561 StartLoadingFavicon(); |
| 555 } | 562 } |
| 556 | 563 |
| 557 void JumpList::OnIncognitoAvailabilityChanged() { | 564 void JumpList::OnIncognitoAvailabilityChanged() { |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 608 void JumpList::TopSitesLoaded(history::TopSites* top_sites) { | 615 void JumpList::TopSitesLoaded(history::TopSites* top_sites) { |
| 609 } | 616 } |
| 610 | 617 |
| 611 void JumpList::TopSitesChanged(history::TopSites* top_sites, | 618 void JumpList::TopSitesChanged(history::TopSites* top_sites, |
| 612 ChangeReason change_reason) { | 619 ChangeReason change_reason) { |
| 613 top_sites->GetMostVisitedURLs( | 620 top_sites->GetMostVisitedURLs( |
| 614 base::Bind(&JumpList::OnMostVisitedURLsAvailable, | 621 base::Bind(&JumpList::OnMostVisitedURLsAvailable, |
| 615 weak_ptr_factory_.GetWeakPtr()), | 622 weak_ptr_factory_.GetWeakPtr()), |
| 616 false); | 623 false); |
| 617 } | 624 } |
| OLD | NEW |