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

Side by Side Diff: chrome/browser/win/jumplist_update_util.cc

Issue 2896233003: Cancel the JumpList update if top 5 most visited URLs are unchanged (Closed)
Patch Set: Fix nits Created 3 years, 6 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
(Empty)
1 // Copyright (c) 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/win/jumplist_update_util.h"
6
7 #include <algorithm>
8 #include <iterator>
9
10 bool MostVisitedItemsUnchanged(const ShellLinkItemList& items,
11 const history::MostVisitedURLList& urls,
12 size_t max_item_count) {
13 // If the number of urls going to be displayed doesn't equal to the current
14 // one, the most visited items are considered to have changes.
15 // Otherwise, check if the current urls stored in |items| equal to the first
16 // |max_item_count| urls in |urls| to determine if the most visited items
17 // are changed or not.
18
19 if (std::min(urls.size(), max_item_count) != items.size())
20 return false;
21
22 return std::equal(std::begin(items), std::end(items), std::begin(urls),
23 [](const auto& item_ptr, const auto& most_visited_url) {
24 return item_ptr->url() == most_visited_url.url.spec();
25 });
26 }
OLDNEW
« no previous file with comments | « chrome/browser/win/jumplist_update_util.h ('k') | chrome/browser/win/jumplist_update_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698