OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ash/common/system/chromeos/network/vpn_list_view.h" | 5 #include "ash/common/system/chromeos/network/vpn_list_view.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 Shell::Get()->vpn_list()->RemoveObserver(this); | 252 Shell::Get()->vpn_list()->RemoveObserver(this); |
253 } | 253 } |
254 | 254 |
255 void VPNListView::Update() { | 255 void VPNListView::Update() { |
256 // Before updating the list, determine whether the user was hovering over one | 256 // Before updating the list, determine whether the user was hovering over one |
257 // of the VPN provider or network entries. | 257 // of the VPN provider or network entries. |
258 std::unique_ptr<VPNProvider> hovered_provider; | 258 std::unique_ptr<VPNProvider> hovered_provider; |
259 std::string hovered_network_guid; | 259 std::string hovered_network_guid; |
260 for (const std::pair<const views::View* const, VPNProvider>& provider : | 260 for (const std::pair<const views::View* const, VPNProvider>& provider : |
261 provider_view_map_) { | 261 provider_view_map_) { |
262 if (static_cast<const HoverHighlightView*>(provider.first)->hover()) { | 262 if (provider.first->IsMouseHovered()) { |
263 hovered_provider.reset(new VPNProvider(provider.second)); | 263 hovered_provider.reset(new VPNProvider(provider.second)); |
264 break; | 264 break; |
265 } | 265 } |
266 } | 266 } |
267 if (!hovered_provider) { | 267 if (!hovered_provider) { |
268 for (const std::pair<const views::View*, std::string>& entry : | 268 for (const std::pair<const views::View*, std::string>& entry : |
269 network_view_guid_map_) { | 269 network_view_guid_map_) { |
270 if (static_cast<const HoverHighlightView*>(entry.first)->hover()) { | 270 if (entry.first->IsMouseHovered()) { |
271 hovered_network_guid = entry.second; | 271 hovered_network_guid = entry.second; |
272 break; | 272 break; |
273 } | 273 } |
274 } | 274 } |
275 } | 275 } |
276 | 276 |
277 // Clear the list. | 277 // Clear the list. |
278 container()->RemoveAllChildViews(true); | 278 container()->RemoveAllChildViews(true); |
279 provider_view_map_.clear(); | 279 provider_view_map_.clear(); |
280 network_view_guid_map_.clear(); | 280 network_view_guid_map_.clear(); |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 } | 413 } |
414 } | 414 } |
415 | 415 |
416 // Add providers without any configured networks, in the order that the | 416 // Add providers without any configured networks, in the order that the |
417 // providers were returned by the extensions system. | 417 // providers were returned by the extensions system. |
418 for (const VPNProvider& provider : providers) | 418 for (const VPNProvider& provider : providers) |
419 AddProviderAndNetworks(provider, networks); | 419 AddProviderAndNetworks(provider, networks); |
420 } | 420 } |
421 | 421 |
422 } // namespace ash | 422 } // namespace ash |
OLD | NEW |