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

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

Issue 21046008: Convert all connect code to use NetworkHandler instead of NetworkLibrary (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Feedbac Round 2.2 Created 7 years, 4 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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 const std::string& userhash) const { 181 const std::string& userhash) const {
182 for (NetworkProfileHandler::ProfileList::const_iterator it = 182 for (NetworkProfileHandler::ProfileList::const_iterator it =
183 profiles_.begin(); 183 profiles_.begin();
184 it != profiles_.end(); ++it) { 184 it != profiles_.end(); ++it) {
185 if (it->userhash == userhash) 185 if (it->userhash == userhash)
186 return &*it; 186 return &*it;
187 } 187 }
188 return NULL; 188 return NULL;
189 } 189 }
190 190
191 const NetworkProfile* NetworkProfileHandler::GetDefaultUserProfile() const {
192 for (NetworkProfileHandler::ProfileList::const_iterator it =
193 profiles_.begin();
194 it != profiles_.end(); ++it) {
195 if (!it->userhash.empty())
196 return &*it;
197 }
198 return NULL;
199 }
200
191 NetworkProfileHandler::NetworkProfileHandler() 201 NetworkProfileHandler::NetworkProfileHandler()
192 : network_state_handler_(NULL), 202 : network_state_handler_(NULL),
193 weak_ptr_factory_(this) { 203 weak_ptr_factory_(this) {
194 } 204 }
195 205
196 void NetworkProfileHandler::Init(NetworkStateHandler* network_state_handler) { 206 void NetworkProfileHandler::Init(NetworkStateHandler* network_state_handler) {
197 network_state_handler_ = network_state_handler; 207 network_state_handler_ = network_state_handler;
198 208
199 DBusThreadManager::Get()->GetShillManagerClient()-> 209 DBusThreadManager::Get()->GetShillManagerClient()->
200 AddPropertyChangedObserver(this); 210 AddPropertyChangedObserver(this);
201 211
202 // Request the initial profile list. 212 // Request the initial profile list.
203 DBusThreadManager::Get()->GetShillManagerClient()->GetProperties( 213 DBusThreadManager::Get()->GetShillManagerClient()->GetProperties(
204 base::Bind(&NetworkProfileHandler::GetManagerPropertiesCallback, 214 base::Bind(&NetworkProfileHandler::GetManagerPropertiesCallback,
205 weak_ptr_factory_.GetWeakPtr())); 215 weak_ptr_factory_.GetWeakPtr()));
206 } 216 }
207 217
208 NetworkProfileHandler::~NetworkProfileHandler() { 218 NetworkProfileHandler::~NetworkProfileHandler() {
209 DBusThreadManager::Get()->GetShillManagerClient()-> 219 DBusThreadManager::Get()->GetShillManagerClient()->
210 RemovePropertyChangedObserver(this); 220 RemovePropertyChangedObserver(this);
211 } 221 }
212 222
213 } // namespace chromeos 223 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698