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

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: Add unittest 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 <algorithm>
6 #include <iterator>
7
8 #include "chrome/browser/win/jumplist_update_util.h"
grt (UTC plus 2) 2017/05/30 08:51:41 nit: move up above other includes (https://google.
chengx 2017/05/30 19:37:02 Done.
9
10 bool MostVisitedItemsUnchanged(const ShellLinkItemList& items,
11 const history::MostVisitedURLList& urls,
12 size_t most_visited_items) {
grt (UTC plus 2) 2017/05/30 08:51:41 nit: max_item_count?
chengx 2017/05/30 19:37:02 Done.
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 // |most_visited_items| urls in |urls| to determine if the most visited items
17 // are changed or not.
18
19 if (size_t(std::min(urls.size(), most_visited_items)) != items.size())
grt (UTC plus 2) 2017/05/30 08:51:41 urls.size() and most_visited_items are both size_t
chengx 2017/05/30 19:37:02 Yes, it should be removed.
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

Powered by Google App Engine
This is Rietveld 408576698