| OLD | NEW |
| 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 "chrome/browser/chromeos/extensions/networking_private_api.h" | 5 #include "chrome/browser/chromeos/extensions/networking_private_api.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "chrome/browser/extensions/extension_function_registry.h" | 10 #include "chrome/browser/extensions/extension_function_registry.h" |
| 11 #include "chrome/browser/profiles/profile.h" |
| 11 #include "chrome/common/extensions/api/networking_private.h" | 12 #include "chrome/common/extensions/api/networking_private.h" |
| 12 #include "chromeos/dbus/dbus_thread_manager.h" | 13 #include "chromeos/dbus/dbus_thread_manager.h" |
| 13 #include "chromeos/dbus/shill_manager_client.h" | 14 #include "chromeos/dbus/shill_manager_client.h" |
| 14 #include "chromeos/network/managed_network_configuration_handler.h" | 15 #include "chromeos/network/managed_network_configuration_handler.h" |
| 15 #include "chromeos/network/network_state.h" | 16 #include "chromeos/network/network_state.h" |
| 16 #include "chromeos/network/network_state_handler.h" | 17 #include "chromeos/network/network_state_handler.h" |
| 17 #include "chromeos/network/onc/onc_constants.h" | 18 #include "chromeos/network/onc/onc_constants.h" |
| 18 #include "chromeos/network/onc/onc_signature.h" | 19 #include "chromeos/network/onc/onc_signature.h" |
| 19 #include "chromeos/network/onc/onc_translator.h" | 20 #include "chromeos/network/onc/onc_translator.h" |
| 20 | 21 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 | 94 |
| 94 NetworkingPrivateGetManagedPropertiesFunction:: | 95 NetworkingPrivateGetManagedPropertiesFunction:: |
| 95 ~NetworkingPrivateGetManagedPropertiesFunction() { | 96 ~NetworkingPrivateGetManagedPropertiesFunction() { |
| 96 } | 97 } |
| 97 | 98 |
| 98 bool NetworkingPrivateGetManagedPropertiesFunction::RunImpl() { | 99 bool NetworkingPrivateGetManagedPropertiesFunction::RunImpl() { |
| 99 scoped_ptr<api::GetManagedProperties::Params> params = | 100 scoped_ptr<api::GetManagedProperties::Params> params = |
| 100 api::GetManagedProperties::Params::Create(*args_); | 101 api::GetManagedProperties::Params::Create(*args_); |
| 101 EXTENSION_FUNCTION_VALIDATE(params); | 102 EXTENSION_FUNCTION_VALIDATE(params); |
| 102 | 103 |
| 104 // The profile of the requesting browser. |
| 105 Profile* requesting_profile = profile(); |
| 106 // TODO(pneubeck): Use ProfileHelper to obtain the userhash, once it provides |
| 107 // that functionality. crbug/238623. |
| 108 std::string userhash = requesting_profile->GetPath().BaseName().value(); |
| 109 |
| 103 ManagedNetworkConfigurationHandler::Get()->GetManagedProperties( | 110 ManagedNetworkConfigurationHandler::Get()->GetManagedProperties( |
| 111 userhash, |
| 104 params->network_guid, // service path | 112 params->network_guid, // service path |
| 105 base::Bind(&NetworkingPrivateGetManagedPropertiesFunction::Success, | 113 base::Bind(&NetworkingPrivateGetManagedPropertiesFunction::Success, |
| 106 this), | 114 this), |
| 107 base::Bind(&NetworkingPrivateGetManagedPropertiesFunction::Failure, | 115 base::Bind(&NetworkingPrivateGetManagedPropertiesFunction::Failure, |
| 108 this)); | 116 this)); |
| 109 return true; | 117 return true; |
| 110 } | 118 } |
| 111 | 119 |
| 112 void NetworkingPrivateGetManagedPropertiesFunction::Success( | 120 void NetworkingPrivateGetManagedPropertiesFunction::Success( |
| 113 const std::string& service_path, | 121 const std::string& service_path, |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 const std::string& result) { | 437 const std::string& result) { |
| 430 results_ = api::VerifyAndEncryptData::Results::Create(result); | 438 results_ = api::VerifyAndEncryptData::Results::Create(result); |
| 431 SendResponse(true); | 439 SendResponse(true); |
| 432 } | 440 } |
| 433 | 441 |
| 434 void NetworkingPrivateVerifyAndEncryptDataFunction::ErrorCallback( | 442 void NetworkingPrivateVerifyAndEncryptDataFunction::ErrorCallback( |
| 435 const std::string& error_name, const std::string& error) { | 443 const std::string& error_name, const std::string& error) { |
| 436 error_ = error_name; | 444 error_ = error_name; |
| 437 SendResponse(false); | 445 SendResponse(false); |
| 438 } | 446 } |
| OLD | NEW |