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

Unified Diff: chromeos/network/network_util.cc

Issue 289383004: Merge FavoriteState into NetworkState (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chromeos/network/network_util.h ('k') | chromeos/network/shill_property_handler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/network/network_util.cc
diff --git a/chromeos/network/network_util.cc b/chromeos/network/network_util.cc
index 3426cad0bb35dbb05e7ebf37d028f64b42fc4195..377167f0a17f4b6222a83e37ce203fdae61ce65e 100644
--- a/chromeos/network/network_util.cc
+++ b/chromeos/network/network_util.cc
@@ -7,7 +7,6 @@
#include "base/strings/string_tokenizer.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
-#include "chromeos/network/favorite_state.h"
#include "chromeos/network/network_state.h"
#include "chromeos/network/network_state_handler.h"
#include "chromeos/network/onc/onc_signature.h"
@@ -140,21 +139,11 @@ bool ParseCellularScanResults(const base::ListValue& list,
return true;
}
-scoped_ptr<base::DictionaryValue> TranslateFavoriteStateToONC(
- const FavoriteState* favorite) {
- // Get the properties from the FavoriteState.
+scoped_ptr<base::DictionaryValue> TranslateNetworkStateToONC(
+ const NetworkState* network) {
+ // Get the properties from the NetworkState.
base::DictionaryValue shill_dictionary;
- favorite->GetStateProperties(&shill_dictionary);
-
- // If a corresponding NetworkState exists, merge its State properties.
- const NetworkState* network_state =
- NetworkHandler::Get()->network_state_handler()->GetNetworkState(
- favorite->path());
- if (network_state) {
- base::DictionaryValue shill_network_dictionary;
- network_state->GetStateProperties(&shill_network_dictionary);
- shill_dictionary.MergeDictionary(&shill_network_dictionary);
- }
+ network->GetStateProperties(&shill_dictionary);
scoped_ptr<base::DictionaryValue> onc_dictionary =
TranslateShillServiceToONCPart(
@@ -168,19 +157,20 @@ scoped_ptr<base::ListValue> TranslateNetworkListToONC(
bool visible_only,
int limit,
bool debugging_properties) {
- NetworkStateHandler::FavoriteStateList favorite_states;
- NetworkHandler::Get()->network_state_handler()->GetFavoriteListByType(
- pattern, configured_only, visible_only, limit, &favorite_states);
+ NetworkStateHandler::NetworkStateList network_states;
+ NetworkHandler::Get()->network_state_handler()->GetNetworkListByType(
+ pattern, configured_only, visible_only, limit, &network_states);
scoped_ptr<base::ListValue> network_properties_list(new base::ListValue);
- for (NetworkStateHandler::FavoriteStateList::iterator it =
- favorite_states.begin();
- it != favorite_states.end();
+ for (NetworkStateHandler::NetworkStateList::iterator it =
+ network_states.begin();
+ it != network_states.end();
++it) {
scoped_ptr<base::DictionaryValue> onc_dictionary =
- TranslateFavoriteStateToONC(*it);
+ TranslateNetworkStateToONC(*it);
if (debugging_properties) {
+ onc_dictionary->SetBoolean("visible", (*it)->visible());
onc_dictionary->SetString("profile_path", (*it)->profile_path());
std::string onc_source = (*it)->ui_data().GetONCSourceAsString();
if (!onc_source.empty())
« no previous file with comments | « chromeos/network/network_util.h ('k') | chromeos/network/shill_property_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698