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

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

Issue 24348002: Migrate DBus service constants from flimflam namespace to shill namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased to ToT Created 7 years, 3 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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_profile_handler.h" 5 #include "chromeos/network/network_profile_handler.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 68
69 void NetworkProfileHandler::GetManagerPropertiesCallback( 69 void NetworkProfileHandler::GetManagerPropertiesCallback(
70 DBusMethodCallStatus call_status, 70 DBusMethodCallStatus call_status,
71 const base::DictionaryValue& properties) { 71 const base::DictionaryValue& properties) {
72 if (DBUS_METHOD_CALL_FAILURE) { 72 if (DBUS_METHOD_CALL_FAILURE) {
73 LOG(ERROR) << "Error when requesting manager properties."; 73 LOG(ERROR) << "Error when requesting manager properties.";
74 return; 74 return;
75 } 75 }
76 76
77 const base::Value* profiles = NULL; 77 const base::Value* profiles = NULL;
78 properties.GetWithoutPathExpansion(flimflam::kProfilesProperty, &profiles); 78 properties.GetWithoutPathExpansion(shill::kProfilesProperty, &profiles);
79 if (!profiles) { 79 if (!profiles) {
80 LOG(ERROR) << "Manager properties returned from Shill don't contain " 80 LOG(ERROR) << "Manager properties returned from Shill don't contain "
81 << "the field " << flimflam::kProfilesProperty; 81 << "the field " << shill::kProfilesProperty;
82 return; 82 return;
83 } 83 }
84 OnPropertyChanged(flimflam::kProfilesProperty, *profiles); 84 OnPropertyChanged(shill::kProfilesProperty, *profiles);
85 } 85 }
86 86
87 void NetworkProfileHandler::OnPropertyChanged(const std::string& name, 87 void NetworkProfileHandler::OnPropertyChanged(const std::string& name,
88 const base::Value& value) { 88 const base::Value& value) {
89 if (name != flimflam::kProfilesProperty) 89 if (name != shill::kProfilesProperty)
90 return; 90 return;
91 91
92 const base::ListValue* profiles_value = NULL; 92 const base::ListValue* profiles_value = NULL;
93 value.GetAsList(&profiles_value); 93 value.GetAsList(&profiles_value);
94 DCHECK(profiles_value); 94 DCHECK(profiles_value);
95 95
96 std::vector<std::string> new_profile_paths; 96 std::vector<std::string> new_profile_paths;
97 bool result = ConvertListValueToStringVector(*profiles_value, 97 bool result = ConvertListValueToStringVector(*profiles_value,
98 &new_profile_paths); 98 &new_profile_paths);
99 DCHECK(result); 99 DCHECK(result);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 // When the profile list changes, ServiceCompleteList may also change, so 134 // When the profile list changes, ServiceCompleteList may also change, so
135 // trigger a Manager update to request the updated list. 135 // trigger a Manager update to request the updated list.
136 if (network_state_handler_) 136 if (network_state_handler_)
137 network_state_handler_->UpdateManagerProperties(); 137 network_state_handler_->UpdateManagerProperties();
138 } 138 }
139 139
140 void NetworkProfileHandler::GetProfilePropertiesCallback( 140 void NetworkProfileHandler::GetProfilePropertiesCallback(
141 const std::string& profile_path, 141 const std::string& profile_path,
142 const base::DictionaryValue& properties) { 142 const base::DictionaryValue& properties) {
143 std::string userhash; 143 std::string userhash;
144 properties.GetStringWithoutPathExpansion(shill::kUserHashProperty, 144 properties.GetStringWithoutPathExpansion(shill::kUserHashProperty, &userhash);
145 &userhash);
146 145
147 AddProfile(NetworkProfile(profile_path, userhash)); 146 AddProfile(NetworkProfile(profile_path, userhash));
148 } 147 }
149 148
150 void NetworkProfileHandler::AddProfile(const NetworkProfile& profile) { 149 void NetworkProfileHandler::AddProfile(const NetworkProfile& profile) {
151 VLOG(2) << "Adding profile " << profile.ToDebugString() << "."; 150 VLOG(2) << "Adding profile " << profile.ToDebugString() << ".";
152 profiles_.push_back(profile); 151 profiles_.push_back(profile);
153 FOR_EACH_OBSERVER(NetworkProfileObserver, observers_, 152 FOR_EACH_OBSERVER(NetworkProfileObserver, observers_,
154 OnProfileAdded(profiles_.back())); 153 OnProfileAdded(profiles_.back()));
155 } 154 }
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 base::Bind(&NetworkProfileHandler::GetManagerPropertiesCallback, 213 base::Bind(&NetworkProfileHandler::GetManagerPropertiesCallback,
215 weak_ptr_factory_.GetWeakPtr())); 214 weak_ptr_factory_.GetWeakPtr()));
216 } 215 }
217 216
218 NetworkProfileHandler::~NetworkProfileHandler() { 217 NetworkProfileHandler::~NetworkProfileHandler() {
219 DBusThreadManager::Get()->GetShillManagerClient()-> 218 DBusThreadManager::Get()->GetShillManagerClient()->
220 RemovePropertyChangedObserver(this); 219 RemovePropertyChangedObserver(this);
221 } 220 }
222 221
223 } // namespace chromeos 222 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/network/network_device_handler_unittest.cc ('k') | chromeos/network/network_sms_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698