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

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

Issue 289383004: Merge FavoriteState into NetworkState (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Elim UpdateManagerProperties, feedback 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 unified diff | Download patch | Annotate | Revision Log
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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 continue; 125 continue;
126 126
127 VLOG(2) << "Requesting properties of profile path " << *it << "."; 127 VLOG(2) << "Requesting properties of profile path " << *it << ".";
128 DBusThreadManager::Get()->GetShillProfileClient()->GetProperties( 128 DBusThreadManager::Get()->GetShillProfileClient()->GetProperties(
129 dbus::ObjectPath(*it), 129 dbus::ObjectPath(*it),
130 base::Bind(&NetworkProfileHandler::GetProfilePropertiesCallback, 130 base::Bind(&NetworkProfileHandler::GetProfilePropertiesCallback,
131 weak_ptr_factory_.GetWeakPtr(), 131 weak_ptr_factory_.GetWeakPtr(),
132 *it), 132 *it),
133 base::Bind(&LogProfileRequestError, *it)); 133 base::Bind(&LogProfileRequestError, *it));
134 } 134 }
135
136 // When the profile list changes, ServiceCompleteList may also change, so
137 // trigger a Manager update to request the updated list.
138 if (network_state_handler_)
139 network_state_handler_->UpdateManagerProperties();
140 } 135 }
141 136
142 void NetworkProfileHandler::GetProfilePropertiesCallback( 137 void NetworkProfileHandler::GetProfilePropertiesCallback(
143 const std::string& profile_path, 138 const std::string& profile_path,
144 const base::DictionaryValue& properties) { 139 const base::DictionaryValue& properties) {
145 std::string userhash; 140 std::string userhash;
146 properties.GetStringWithoutPathExpansion(shill::kUserHashProperty, &userhash); 141 properties.GetStringWithoutPathExpansion(shill::kUserHashProperty, &userhash);
147 142
148 AddProfile(NetworkProfile(profile_path, userhash)); 143 AddProfile(NetworkProfile(profile_path, userhash));
149 } 144 }
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 for (NetworkProfileHandler::ProfileList::const_iterator it = 188 for (NetworkProfileHandler::ProfileList::const_iterator it =
194 profiles_.begin(); 189 profiles_.begin();
195 it != profiles_.end(); ++it) { 190 it != profiles_.end(); ++it) {
196 if (!it->userhash.empty()) 191 if (!it->userhash.empty())
197 return &*it; 192 return &*it;
198 } 193 }
199 return NULL; 194 return NULL;
200 } 195 }
201 196
202 NetworkProfileHandler::NetworkProfileHandler() 197 NetworkProfileHandler::NetworkProfileHandler()
203 : network_state_handler_(NULL), 198 : network_state_handler_(NULL),
pneubeck (no reviews) 2014/06/11 12:44:56 dependency on network_state_handler_ not necessary
stevenjb 2014/06/11 23:31:41 Done.
204 weak_ptr_factory_(this) { 199 weak_ptr_factory_(this) {
205 } 200 }
206 201
207 void NetworkProfileHandler::Init(NetworkStateHandler* network_state_handler) { 202 void NetworkProfileHandler::Init(NetworkStateHandler* network_state_handler) {
208 network_state_handler_ = network_state_handler; 203 network_state_handler_ = network_state_handler;
209 204
210 DBusThreadManager::Get()->GetShillManagerClient()-> 205 DBusThreadManager::Get()->GetShillManagerClient()->
211 AddPropertyChangedObserver(this); 206 AddPropertyChangedObserver(this);
212 207
213 // Request the initial profile list. 208 // Request the initial profile list.
214 DBusThreadManager::Get()->GetShillManagerClient()->GetProperties( 209 DBusThreadManager::Get()->GetShillManagerClient()->GetProperties(
215 base::Bind(&NetworkProfileHandler::GetManagerPropertiesCallback, 210 base::Bind(&NetworkProfileHandler::GetManagerPropertiesCallback,
216 weak_ptr_factory_.GetWeakPtr())); 211 weak_ptr_factory_.GetWeakPtr()));
217 } 212 }
218 213
219 NetworkProfileHandler::~NetworkProfileHandler() { 214 NetworkProfileHandler::~NetworkProfileHandler() {
220 DBusThreadManager::Get()->GetShillManagerClient()-> 215 DBusThreadManager::Get()->GetShillManagerClient()->
221 RemovePropertyChangedObserver(this); 216 RemovePropertyChangedObserver(this);
222 } 217 }
223 218
224 } // namespace chromeos 219 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698