From bb670e0da6d028a0eec7b0a1b7b8e9c753cbfd53 Mon Sep 17 00:00:00 2001 From: Steven Bennetts Date: Fri, 2 Mar 2018 17:00:39 +0000 Subject: [PATCH] Partial revert of Network List: Fix edge case Bug was introduced here: https://chromium-review.googlesource.com/920790 Change introducing the bug was not actually related to the fix in that CL. Bug: 817706 Change-Id: I9e73f05fe66745b1b7651333a6d715c682018a1a Reviewed-on: https://chromium-review.googlesource.com/944161 Reviewed-by: Jenny Zhang Commit-Queue: Steven Bennetts Cr-Commit-Position: refs/heads/master@{#540536} --- ash/system/network/network_list.cc | 8 ++------ ash/system/network/network_list.h | 3 +-- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/ash/system/network/network_list.cc b/ash/system/network/network_list.cc index b78fc65e4bd1..036eb9b2c61c 100644 --- a/ash/system/network/network_list.cc +++ b/ash/system/network/network_list.cc @@ -845,21 +845,18 @@ std::unique_ptr> NetworkListView::UpdateNetworkChildren( for (const auto& info : network_list_) { if (info->type != type) continue; - if (UpdateNetworkChild(index, info.get())) - ++index; + UpdateNetworkChild(index++, info.get()); new_guids->insert(info->guid); } return new_guids; } -bool NetworkListView::UpdateNetworkChild(int index, const NetworkInfo* info) { - bool added = false; +void NetworkListView::UpdateNetworkChild(int index, const NetworkInfo* info) { HoverHighlightView* network_view = nullptr; NetworkGuidMap::const_iterator found = network_guid_map_.find(info->guid); if (found == network_guid_map_.end()) { network_view = new HoverHighlightView(this); UpdateViewForNetwork(network_view, *info); - added = true; } else { network_view = found->second; if (NeedUpdateViewForNetwork(*info)) @@ -870,7 +867,6 @@ bool NetworkListView::UpdateNetworkChild(int index, const NetworkInfo* info) { network_view->SetEnabled(false); network_map_[network_view] = info->guid; network_guid_map_[info->guid] = network_view; - return added; } void NetworkListView::PlaceViewAtIndex(views::View* view, int index) { diff --git a/ash/system/network/network_list.h b/ash/system/network/network_list.h index 6ae1f8fb13e1..f1f59e8a5d3d 100644 --- a/ash/system/network/network_list.h +++ b/ash/system/network/network_list.h @@ -93,8 +93,7 @@ class NetworkListView : public NetworkStateListDetailedView, std::unique_ptr> UpdateNetworkChildren( NetworkInfo::Type type, int child_index); - // Returns true if a new child was added. - bool UpdateNetworkChild(int index, const NetworkInfo* info); + void UpdateNetworkChild(int index, const NetworkInfo* info); // Reorders children of |scroll_content()| as necessary placing |view| at // |index|.