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/system/chromeos/network/vpn_list_view.h" | 5 #include "ash/system/chromeos/network/vpn_list_view.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "ash/metrics/user_metrics_recorder.h" | 10 #include "ash/metrics/user_metrics_recorder.h" |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
232 | 232 |
233 } // namespace | 233 } // namespace |
234 | 234 |
235 VPNListView::VPNListView(ui::NetworkListDelegate* delegate) | 235 VPNListView::VPNListView(ui::NetworkListDelegate* delegate) |
236 : delegate_(delegate) { | 236 : delegate_(delegate) { |
237 Shell::GetInstance()->system_tray_delegate()->GetVPNDelegate()->AddObserver( | 237 Shell::GetInstance()->system_tray_delegate()->GetVPNDelegate()->AddObserver( |
238 this); | 238 this); |
239 } | 239 } |
240 | 240 |
241 VPNListView::~VPNListView() { | 241 VPNListView::~VPNListView() { |
242 Shell::GetInstance() | 242 // We need the check as on shell destruction, the delegate is destroyed first. |
bartfab (slow)
2015/10/16 15:45:25
You are masking a bug here: VPNDelegate expects al
stevenjb
2015/10/16 16:50:07
This is actually correct (but see note below).
*
bartfab (slow)
2015/10/16 16:55:22
VPNDelegate will currently DCHECK() in its destruc
stevenjb
2015/10/16 17:46:18
I see. I think this pattern (without the DCHECK on
emaxx
2015/10/16 17:58:10
Bartosz, first of all, thanks for pointing at the
emaxx
2015/10/16 17:58:10
I think the idea behind the existing code is that
stevenjb
2015/10/16 18:06:40
I'm not sure if that is correct. At one point we s
emaxx
2015/10/28 15:14:38
Done.
| |
243 ->system_tray_delegate() | 243 SystemTrayDelegate* const system_tray_delegate = |
244 ->GetVPNDelegate() | 244 Shell::GetInstance()->system_tray_delegate(); |
245 ->RemoveObserver(this); | 245 if (system_tray_delegate) |
246 system_tray_delegate->GetVPNDelegate()->RemoveObserver(this); | |
246 } | 247 } |
247 | 248 |
248 void VPNListView::Update() { | 249 void VPNListView::Update() { |
249 // Before updating the list, determine whether the user was hovering over one | 250 // Before updating the list, determine whether the user was hovering over one |
250 // of the VPN provider or network entries. | 251 // of the VPN provider or network entries. |
251 scoped_ptr<VPNProvider::Key> hovered_provider_key; | 252 scoped_ptr<VPNProvider::Key> hovered_provider_key; |
252 std::string hovered_network_service_path; | 253 std::string hovered_network_service_path; |
253 for (const std::pair<const views::View* const, VPNProvider::Key>& provider : | 254 for (const std::pair<const views::View* const, VPNProvider::Key>& provider : |
254 provider_view_key_map_) { | 255 provider_view_key_map_) { |
255 if (static_cast<const HoverHighlightView*>(provider.first)->hover()) { | 256 if (static_cast<const HoverHighlightView*>(provider.first)->hover()) { |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
410 } | 411 } |
411 } | 412 } |
412 | 413 |
413 // Add providers without any configured networks, in the order that the | 414 // Add providers without any configured networks, in the order that the |
414 // providers were returned by the extensions system. | 415 // providers were returned by the extensions system. |
415 for (const VPNProvider& provider : providers) | 416 for (const VPNProvider& provider : providers) |
416 AddProviderAndNetworks(provider.key, provider.name, networks); | 417 AddProviderAndNetworks(provider.key, provider.name, networks); |
417 } | 418 } |
418 | 419 |
419 } // namespace ash | 420 } // namespace ash |
OLD | NEW |