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

Side by Side Diff: chromeos/dbus/shill_service_client_stub.cc

Issue 14134007: NetworkPortalDetector/NetworkStateInformer: Switch over to use NetworkStateHandler (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add proxy_config Created 7 years, 7 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/dbus/shill_service_client_stub.h" 5 #include "chromeos/dbus/shill_service_client_stub.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 const base::Value& value, 99 const base::Value& value,
100 const base::Closure& callback, 100 const base::Closure& callback,
101 const ErrorCallback& error_callback) { 101 const ErrorCallback& error_callback) {
102 base::DictionaryValue* dict = NULL; 102 base::DictionaryValue* dict = NULL;
103 if (!stub_services_.GetDictionaryWithoutPathExpansion( 103 if (!stub_services_.GetDictionaryWithoutPathExpansion(
104 service_path.value(), &dict)) { 104 service_path.value(), &dict)) {
105 error_callback.Run("Error.InvalidService", "Invalid Service"); 105 error_callback.Run("Error.InvalidService", "Invalid Service");
106 return; 106 return;
107 } 107 }
108 if (name == flimflam::kStateProperty) { 108 if (name == flimflam::kStateProperty) {
109 // If we connect to a service, then we move it to the top of the list in 109 // If the service went into a connected state, then move it to the top of
110 // the manager client. 110 // the list in the manager client.
111 // TODO(gauravsh): Generalize to sort services properly to allow for testing
112 // more complex scenarios.
111 std::string state; 113 std::string state;
112 if (value.GetAsString(&state) && state == flimflam::kStateOnline) { 114 if (value.GetAsString(&state) && (state == flimflam::kStateOnline ||
115 state == flimflam::kStatePortal)) {
113 ShillManagerClient* manager_client = 116 ShillManagerClient* manager_client =
114 DBusThreadManager::Get()->GetShillManagerClient(); 117 DBusThreadManager::Get()->GetShillManagerClient();
115 manager_client->GetTestInterface()->RemoveService(service_path.value()); 118 manager_client->GetTestInterface()->RemoveService(service_path.value());
116 manager_client->GetTestInterface()->AddServiceAtIndex( 119 manager_client->GetTestInterface()->AddServiceAtIndex(
117 service_path.value(), 0, true); 120 service_path.value(), 0, true);
118 } 121 }
119 } 122 }
120 dict->SetWithoutPathExpansion(name, value.DeepCopy()); 123 dict->SetWithoutPathExpansion(name, value.DeepCopy());
121 MessageLoop::current()->PostTask( 124 MessageLoop::current()->PostTask(
122 FROM_HERE, 125 FROM_HERE,
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 std::map<dbus::ObjectPath, PropertyObserverList*>::iterator iter = 437 std::map<dbus::ObjectPath, PropertyObserverList*>::iterator iter =
435 observer_list_.find(device_path); 438 observer_list_.find(device_path);
436 if (iter != observer_list_.end()) 439 if (iter != observer_list_.end())
437 return *(iter->second); 440 return *(iter->second);
438 PropertyObserverList* observer_list = new PropertyObserverList(); 441 PropertyObserverList* observer_list = new PropertyObserverList();
439 observer_list_[device_path] = observer_list; 442 observer_list_[device_path] = observer_list;
440 return *observer_list; 443 return *observer_list;
441 } 444 }
442 445
443 } // namespace chromeos 446 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698