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

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

Issue 1417853002: Add IPv6 Address to status tray (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 months 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
« no previous file with comments | « chromeos/network/device_state.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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 "chromeos/network/device_state.h" 5 #include "chromeos/network/device_state.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "chromeos/network/network_event_log.h" 10 #include "chromeos/network/network_event_log.h"
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 NET_LOG_EVENT("IPConfig Updated: " + ip_config_path, path()); 121 NET_LOG_EVENT("IPConfig Updated: " + ip_config_path, path());
122 ip_config->Clear(); 122 ip_config->Clear();
123 } else { 123 } else {
124 NET_LOG_EVENT("IPConfig Added: " + ip_config_path, path()); 124 NET_LOG_EVENT("IPConfig Added: " + ip_config_path, path());
125 ip_config = new base::DictionaryValue; 125 ip_config = new base::DictionaryValue;
126 ip_configs_.SetWithoutPathExpansion(ip_config_path, ip_config); 126 ip_configs_.SetWithoutPathExpansion(ip_config_path, ip_config);
127 } 127 }
128 ip_config->MergeDictionary(&properties); 128 ip_config->MergeDictionary(&properties);
129 } 129 }
130 130
131 std::string DeviceState::GetIpAddressByType(const std::string& type) const {
132 for (base::DictionaryValue::Iterator iter(ip_configs_); !iter.IsAtEnd();
133 iter.Advance()) {
134 const base::DictionaryValue* ip_config;
135 if (!iter.value().GetAsDictionary(&ip_config))
136 continue;
137 std::string ip_config_method;
138 if (!ip_config->GetString(shill::kMethodProperty, &ip_config_method))
139 continue;
140 if (type == ip_config_method ||
141 (type == shill::kTypeIPv4 && ip_config_method == shill::kTypeDHCP) ||
142 (type == shill::kTypeIPv6 && ip_config_method == shill::kTypeDHCP6)) {
143 std::string address;
144 if (!ip_config->GetString(shill::kAddressProperty, &address))
145 continue;
146 return address;
147 }
148 }
149 return std::string();
150 }
151
131 bool DeviceState::IsSimAbsent() const { 152 bool DeviceState::IsSimAbsent() const {
132 return technology_family_ == shill::kTechnologyFamilyGsm && !sim_present_; 153 return technology_family_ == shill::kTechnologyFamilyGsm && !sim_present_;
133 } 154 }
134 155
135 } // namespace chromeos 156 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/network/device_state.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698