blob: 91bc6df4e53450a0c28616e9d7849ae382b8bce3 [file] [log] [blame]
Avi Drissman4a8573c2022-09-09 19:35:541// Copyright 2017 The Chromium Authors
chengx61e622b2017-05-31 20:59:272// 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
10bool 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}