Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(168)

Side by Side Diff: chromeos/network/network_state.cc

Issue 11192024: Add chromeos::NetworkStateManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix comment Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chromeos/network/network_state.h ('k') | chromeos/network/network_state_handler.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 "chromeos/network/network_state.h"
6
7 #include "base/values.h"
8 #include "third_party/cros_system_api/dbus/service_constants.h"
9
10 namespace chromeos {
11
12 NetworkState::NetworkState(const std::string& path)
13 : ManagedState(MANAGED_TYPE_NETWORK, path),
14 signal_strength_(0) {
15 }
16
17 NetworkState::~NetworkState() {
18 }
19
20 bool NetworkState::PropertyChanged(const std::string& key,
21 const base::Value& value) {
22 if (ManagedStatePropertyChanged(key, value))
23 return true;
24 if (key == flimflam::kSignalStrengthProperty) {
25 return GetIntegerValue(key, value, &signal_strength_);
26 } else if (key == flimflam::kStateProperty) {
27 return GetStringValue(key, value, &state_);
28 } else if (key == flimflam::kErrorProperty) {
29 return GetStringValue(key, value, &error_);
30 } else if (key == flimflam::kActivationStateProperty) {
31 return GetStringValue(key, value, &activation_state_);
32 } else if (key == flimflam::kRoamingStateProperty) {
33 return GetStringValue(key, value, &roaming_);
34 } else if (key == flimflam::kSecurityProperty) {
35 return GetStringValue(key, value, &security_);
36 } else if (key == flimflam::kNetworkTechnologyProperty) {
37 return GetStringValue(key, value, &technology_);
38 } else if (key == flimflam::kDeviceProperty) {
39 return GetStringValue(key, value, &device_path_);
40 }
41 return false;
42 }
43
44 bool NetworkState::IsConnectedState() const {
45 return StateIsConnected(state_);
46 }
47
48 bool NetworkState::IsConnectingState() const {
49 return StateIsConnecting(state_);
50 }
51
52 // static
53 bool NetworkState::StateIsConnected(const std::string& state) {
54 return (state == flimflam::kStateReady ||
55 state == flimflam::kStateOnline ||
56 state == flimflam::kStatePortal);
57 }
58
59 // static
60 bool NetworkState::StateIsConnecting(const std::string& state) {
61 return (state == flimflam::kStateAssociation ||
62 state == flimflam::kStateConfiguration ||
63 state == flimflam::kStateCarrier);
64 }
65
66 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/network/network_state.h ('k') | chromeos/network/network_state_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698