Index: chrome/browser/win/jumplist_update_util.cc |
diff --git a/chrome/browser/win/jumplist_update_util.cc b/chrome/browser/win/jumplist_update_util.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..c8a8a25f6d8319b4e7cfbf0e905559ae26466196 |
--- /dev/null |
+++ b/chrome/browser/win/jumplist_update_util.cc |
@@ -0,0 +1,26 @@ |
+// Copyright (c) 2017 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "chrome/browser/win/jumplist_update_util.h" |
+ |
+#include <algorithm> |
+#include <iterator> |
+ |
+bool MostVisitedItemsUnchanged(const ShellLinkItemList& items, |
+ const history::MostVisitedURLList& urls, |
+ size_t max_item_count) { |
+ // If the number of urls going to be displayed doesn't equal to the current |
+ // one, the most visited items are considered to have changes. |
+ // Otherwise, check if the current urls stored in |items| equal to the first |
+ // |max_item_count| urls in |urls| to determine if the most visited items |
+ // are changed or not. |
+ |
+ if (std::min(urls.size(), max_item_count) != items.size()) |
+ return false; |
+ |
+ return std::equal(std::begin(items), std::end(items), std::begin(urls), |
+ [](const auto& item_ptr, const auto& most_visited_url) { |
+ return item_ptr->url() == most_visited_url.url.spec(); |
+ }); |
+} |