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

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

Issue 20087002: Add migration from CaCert NSS nicknames to PEM. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix unittests depending on NetworkHandler and not on CertLoader. 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
« no previous file with comments | « chromeos/chromeos.gyp ('k') | chromeos/network/network_cert_migrator.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
11 #include "base/strings/string_util.h"
11 #include "base/values.h" 12 #include "base/values.h"
12 #include "chromeos/chromeos_switches.h" 13 #include "chromeos/chromeos_switches.h"
13 #include "chromeos/dbus/dbus_thread_manager.h" 14 #include "chromeos/dbus/dbus_thread_manager.h"
14 #include "chromeos/dbus/shill_manager_client.h" 15 #include "chromeos/dbus/shill_manager_client.h"
15 #include "chromeos/dbus/shill_property_changed_observer.h" 16 #include "chromeos/dbus/shill_property_changed_observer.h"
16 #include "dbus/bus.h" 17 #include "dbus/bus.h"
17 #include "dbus/message.h" 18 #include "dbus/message.h"
18 #include "dbus/object_proxy.h" 19 #include "dbus/object_proxy.h"
19 #include "third_party/cros_system_api/dbus/service_constants.h" 20 #include "third_party/cros_system_api/dbus/service_constants.h"
20 21
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 // the list in the manager client. 350 // the list in the manager client.
350 // TODO(gauravsh): Generalize to sort services properly to allow for testing 351 // TODO(gauravsh): Generalize to sort services properly to allow for testing
351 // more complex scenarios. 352 // more complex scenarios.
352 std::string state; 353 std::string state;
353 if (value.GetAsString(&state) && (state == flimflam::kStateOnline || 354 if (value.GetAsString(&state) && (state == flimflam::kStateOnline ||
354 state == flimflam::kStatePortal)) { 355 state == flimflam::kStatePortal)) {
355 DBusThreadManager::Get()->GetShillManagerClient()->GetTestInterface()-> 356 DBusThreadManager::Get()->GetShillManagerClient()->GetTestInterface()->
356 MoveServiceToIndex(service_path, 0, true); 357 MoveServiceToIndex(service_path, 0, true);
357 } 358 }
358 } 359 }
359 dict->SetWithoutPathExpansion(property, value.DeepCopy()); 360 base::DictionaryValue new_properties;
361 std::string changed_property;
362 bool case_sensitive = true;
363 if (StartsWithASCII(property, "Provider.", case_sensitive) ||
364 StartsWithASCII(property, "OpenVPN.", case_sensitive) ||
365 StartsWithASCII(property, "L2TPIPsec.", case_sensitive)) {
366 // These properties are only nested within the Provider dictionary if read
367 // from Shill.
368 base::DictionaryValue* provider = new base::DictionaryValue;
369 provider->SetWithoutPathExpansion(property, value.DeepCopy());
370 new_properties.SetWithoutPathExpansion(flimflam::kProviderProperty,
371 provider);
372 changed_property = flimflam::kProviderProperty;
373 } else {
374 new_properties.SetWithoutPathExpansion(property, value.DeepCopy());
375 changed_property = property;
376 }
377
378 dict->MergeDictionary(&new_properties);
360 base::MessageLoop::current()->PostTask( 379 base::MessageLoop::current()->PostTask(
361 FROM_HERE, 380 FROM_HERE,
362 base::Bind(&ShillServiceClientStub::NotifyObserversPropertyChanged, 381 base::Bind(&ShillServiceClientStub::NotifyObserversPropertyChanged,
363 weak_ptr_factory_.GetWeakPtr(), 382 weak_ptr_factory_.GetWeakPtr(),
364 dbus::ObjectPath(service_path), property)); 383 dbus::ObjectPath(service_path), changed_property));
365 return true; 384 return true;
366 } 385 }
367 386
368 const base::DictionaryValue* ShillServiceClientStub::GetServiceProperties( 387 const base::DictionaryValue* ShillServiceClientStub::GetServiceProperties(
369 const std::string& service_path) const { 388 const std::string& service_path) const {
370 const base::DictionaryValue* properties = NULL; 389 const base::DictionaryValue* properties = NULL;
371 stub_services_.GetDictionaryWithoutPathExpansion(service_path, &properties); 390 stub_services_.GetDictionaryWithoutPathExpansion(service_path, &properties);
372 return properties; 391 return properties;
373 } 392 }
374 393
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 std::map<dbus::ObjectPath, PropertyObserverList*>::iterator iter = 513 std::map<dbus::ObjectPath, PropertyObserverList*>::iterator iter =
495 observer_list_.find(device_path); 514 observer_list_.find(device_path);
496 if (iter != observer_list_.end()) 515 if (iter != observer_list_.end())
497 return *(iter->second); 516 return *(iter->second);
498 PropertyObserverList* observer_list = new PropertyObserverList(); 517 PropertyObserverList* observer_list = new PropertyObserverList();
499 observer_list_[device_path] = observer_list; 518 observer_list_[device_path] = observer_list;
500 return *observer_list; 519 return *observer_list;
501 } 520 }
502 521
503 } // namespace chromeos 522 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/chromeos.gyp ('k') | chromeos/network/network_cert_migrator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698