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

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: rebase again 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()->MoveServiceToIndex( 118 manager_client->GetTestInterface()->MoveServiceToIndex(
116 service_path.value(), 0, true); 119 service_path.value(), 0, true);
117 } 120 }
118 } 121 }
119 dict->SetWithoutPathExpansion(name, value.DeepCopy()); 122 dict->SetWithoutPathExpansion(name, value.DeepCopy());
120 MessageLoop::current()->PostTask( 123 MessageLoop::current()->PostTask(
121 FROM_HERE, 124 FROM_HERE,
122 base::Bind(&ShillServiceClientStub::NotifyObserversPropertyChanged, 125 base::Bind(&ShillServiceClientStub::NotifyObserversPropertyChanged,
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 std::map<dbus::ObjectPath, PropertyObserverList*>::iterator iter = 446 std::map<dbus::ObjectPath, PropertyObserverList*>::iterator iter =
444 observer_list_.find(device_path); 447 observer_list_.find(device_path);
445 if (iter != observer_list_.end()) 448 if (iter != observer_list_.end())
446 return *(iter->second); 449 return *(iter->second);
447 PropertyObserverList* observer_list = new PropertyObserverList(); 450 PropertyObserverList* observer_list = new PropertyObserverList();
448 observer_list_[device_path] = observer_list; 451 observer_list_[device_path] = observer_list;
449 return *observer_list; 452 return *observer_list;
450 } 453 }
451 454
452 } // namespace chromeos 455 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc ('k') | chromeos/network/network_state.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698