Skip to content

Commit

Permalink
Partial revert of Network List: Fix edge case
Browse files Browse the repository at this point in the history
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 <jennyz@chromium.org>
Commit-Queue: Steven Bennetts <stevenjb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#540536}
  • Loading branch information
stevenjb authored and Commit Bot committed Mar 2, 2018
1 parent 8367650 commit bb670e0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
8 changes: 2 additions & 6 deletions ash/system/network/network_list.cc
Original file line number Diff line number Diff line change
Expand Up @@ -845,21 +845,18 @@ std::unique_ptr<std::set<std::string>> 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))
Expand All @@ -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) {
Expand Down
3 changes: 1 addition & 2 deletions ash/system/network/network_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,7 @@ class NetworkListView : public NetworkStateListDetailedView,
std::unique_ptr<std::set<std::string>> 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|.
Expand Down

0 comments on commit bb670e0

Please sign in to comment.