OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2012 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 "ash/system/chromeos/network/tray_network_state_observer.h" | |
6 | |
7 #include "ash/system/chromeos/network/network_detailed_view.h" | |
8 #include "ash/system/chromeos/network/tray_network.h" | |
9 #include "ash/system/tray/tray_constants.h" | |
10 #include "chromeos/network/network_state_handler.h" | |
11 #include "third_party/cros_system_api/dbus/service_constants.h" | |
12 | |
13 namespace ash { | |
14 namespace internal { | |
15 | |
16 TrayNetworkStateObserver::TrayNetworkStateObserver(TrayNetwork* tray) | |
17 : tray_(tray), | |
18 wifi_state_(WIFI_UNKNOWN) { | |
19 chromeos::NetworkStateHandler::Get()->AddObserver(this); | |
20 } | |
21 | |
22 TrayNetworkStateObserver::~TrayNetworkStateObserver() { | |
23 chromeos::NetworkStateHandler::Get()->RemoveObserver(this); | |
24 } | |
25 | |
26 void TrayNetworkStateObserver::NetworkManagerChanged( | |
27 const std::string& property) { | |
28 tray::NetworkDetailedView* detailed = tray_->detailed(); | |
29 bool wifi_enabled = chromeos::NetworkStateHandler::Get()-> | |
30 TechnologyEnabled(flimflam::kTypeWifi); | |
31 WifiState wifi_state = wifi_enabled ? WIFI_ENABLED : WIFI_DISABLED; | |
32 if ((wifi_state_ != WIFI_UNKNOWN && wifi_state_ != wifi_state) && | |
33 (!detailed || | |
34 detailed->GetViewType() == tray::NetworkDetailedView::WIFI_VIEW)) { | |
35 tray_->set_request_wifi_view(true); | |
36 tray_->PopupDetailedView(kTrayPopupAutoCloseDelayForTextInSeconds, false); | |
jennyz
2012/11/27 01:43:52
Is this a new UI feature for popping up detailed n
stevenjb
2012/11/27 17:20:32
This replaces TrayNetwork::OnWillToggleWifi() whic
| |
37 } | |
38 wifi_state_ = wifi_state; | |
39 if (detailed) | |
40 detailed->ManagerChanged(); | |
41 } | |
42 | |
43 void TrayNetworkStateObserver::NetworkListChanged( | |
44 const NetworkStateList& networks) { | |
45 tray::NetworkDetailedView* detailed = tray_->detailed(); | |
46 if (detailed) | |
47 detailed->NetworkListChanged(networks); | |
48 } | |
49 | |
50 void TrayNetworkStateObserver::NetworkServiceChanged(const std::string& path) { | |
51 tray::NetworkDetailedView* detailed = tray_->detailed(); | |
52 if (detailed) | |
53 detailed->NetworkServiceChanged(path); | |
54 } | |
55 | |
56 } // namespace ash | |
57 } // namespace internal | |
OLD | NEW |