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

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

Issue 383013002: Remove additional dependencies from InternetOptionsHandler (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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 | Annotate | Revision Log
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/network_util.h" 5 #include "chromeos/network/network_util.h"
6 6
7 #include "base/strings/string_tokenizer.h" 7 #include "base/strings/string_tokenizer.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "chromeos/login/login_state.h"
11 #include "chromeos/network/managed_network_configuration_handler.h"
10 #include "chromeos/network/network_state.h" 12 #include "chromeos/network/network_state.h"
11 #include "chromeos/network/network_state_handler.h" 13 #include "chromeos/network/network_state_handler.h"
12 #include "chromeos/network/onc/onc_signature.h" 14 #include "chromeos/network/onc/onc_signature.h"
13 #include "chromeos/network/onc/onc_translation_tables.h" 15 #include "chromeos/network/onc/onc_translation_tables.h"
14 #include "chromeos/network/onc/onc_translator.h" 16 #include "chromeos/network/onc/onc_translator.h"
17 #include "chromeos/network/onc/onc_utils.h"
15 #include "third_party/cros_system_api/dbus/service_constants.h" 18 #include "third_party/cros_system_api/dbus/service_constants.h"
16 19
17 namespace chromeos { 20 namespace chromeos {
18 21
19 WifiAccessPoint::WifiAccessPoint() 22 WifiAccessPoint::WifiAccessPoint()
20 : signal_strength(0), 23 : signal_strength(0),
21 signal_to_noise(0), 24 signal_to_noise(0),
22 channel(0) { 25 channel(0) {
23 } 26 }
24 27
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 scoped_ptr<base::ListValue> TranslateNetworkListToONC( 158 scoped_ptr<base::ListValue> TranslateNetworkListToONC(
156 NetworkTypePattern pattern, 159 NetworkTypePattern pattern,
157 bool configured_only, 160 bool configured_only,
158 bool visible_only, 161 bool visible_only,
159 int limit, 162 int limit,
160 bool debugging_properties) { 163 bool debugging_properties) {
161 NetworkStateHandler::NetworkStateList network_states; 164 NetworkStateHandler::NetworkStateList network_states;
162 NetworkHandler::Get()->network_state_handler()->GetNetworkListByType( 165 NetworkHandler::Get()->network_state_handler()->GetNetworkListByType(
163 pattern, configured_only, visible_only, limit, &network_states); 166 pattern, configured_only, visible_only, limit, &network_states);
164 167
168 std::string userhash = LoginState::Get()->primary_user_hash();
pneubeck (no reviews) 2014/07/11 20:35:07 It seems to me that this is unexpected and will ev
stevenjb 2014/07/11 21:26:10 I'll rip this out for now, it's handy but not wort
169 ManagedNetworkConfigurationHandler* config_handler =
170 NetworkHandler::Get()->managed_network_configuration_handler();
171
165 scoped_ptr<base::ListValue> network_properties_list(new base::ListValue); 172 scoped_ptr<base::ListValue> network_properties_list(new base::ListValue);
166 for (NetworkStateHandler::NetworkStateList::iterator it = 173 for (NetworkStateHandler::NetworkStateList::iterator it =
167 network_states.begin(); 174 network_states.begin();
168 it != network_states.end(); 175 it != network_states.end();
169 ++it) { 176 ++it) {
170 scoped_ptr<base::DictionaryValue> onc_dictionary = 177 scoped_ptr<base::DictionaryValue> onc_dictionary =
171 TranslateNetworkStateToONC(*it); 178 TranslateNetworkStateToONC(*it);
172 179
173 if (debugging_properties) { 180 if (debugging_properties) {
174 onc_dictionary->SetBoolean("connectable", (*it)->connectable()); 181 onc_dictionary->SetBoolean("connectable", (*it)->connectable());
175 onc_dictionary->SetBoolean("visible", (*it)->visible()); 182 onc_dictionary->SetBoolean("visible", (*it)->visible());
176 onc_dictionary->SetString("profile_path", (*it)->profile_path()); 183 onc_dictionary->SetString("profile_path", (*it)->profile_path());
177 onc_dictionary->SetString("service_path", (*it)->path()); 184 onc_dictionary->SetString("service_path", (*it)->path());
178 std::string onc_source = (*it)->ui_data().GetONCSourceAsString(); 185 ::onc::ONCSource onc_source;
179 if (!onc_source.empty()) 186 config_handler->FindPolicyByGUID(userhash, (*it)->guid(), &onc_source);
180 onc_dictionary->SetString("onc_source", onc_source); 187 onc_dictionary->SetString("onc_source",
188 onc::GetSourceAsString(onc_source));
181 } 189 }
182 190
183 network_properties_list->Append(onc_dictionary.release()); 191 network_properties_list->Append(onc_dictionary.release());
184 } 192 }
185 return network_properties_list.Pass(); 193 return network_properties_list.Pass();
186 } 194 }
187 195
188 std::string TranslateONCTypeToShill(const std::string& onc_type) { 196 std::string TranslateONCTypeToShill(const std::string& onc_type) {
189 if (onc_type == ::onc::network_type::kEthernet) 197 if (onc_type == ::onc::network_type::kEthernet)
190 return shill::kTypeEthernet; 198 return shill::kTypeEthernet;
191 std::string shill_type; 199 std::string shill_type;
192 onc::TranslateStringToShill(onc::kNetworkTypeTable, onc_type, &shill_type); 200 onc::TranslateStringToShill(onc::kNetworkTypeTable, onc_type, &shill_type);
193 return shill_type; 201 return shill_type;
194 } 202 }
195 203
196 } // namespace network_util 204 } // namespace network_util
197 } // namespace chromeos 205 } // namespace chromeos
OLDNEW
« chromeos/network/network_state.h ('K') | « chromeos/network/network_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698