| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 | 65 |
| 65 NetworkingPrivateGetManagedPropertiesFunction:: | 66 NetworkingPrivateGetManagedPropertiesFunction:: |
| 66 ~NetworkingPrivateGetManagedPropertiesFunction() { | 67 ~NetworkingPrivateGetManagedPropertiesFunction() { |
| 67 } | 68 } |
| 68 | 69 |
| 69 bool NetworkingPrivateGetManagedPropertiesFunction::RunImpl() { | 70 bool NetworkingPrivateGetManagedPropertiesFunction::RunImpl() { |
| 70 scoped_ptr<api::GetManagedProperties::Params> params = | 71 scoped_ptr<api::GetManagedProperties::Params> params = |
| 71 api::GetManagedProperties::Params::Create(*args_); | 72 api::GetManagedProperties::Params::Create(*args_); |
| 72 EXTENSION_FUNCTION_VALIDATE(params); | 73 EXTENSION_FUNCTION_VALIDATE(params); |
| 73 | 74 |
| 75 // The profile of the requesting browser. |
| 76 Profile* requesting_profile = profile(); |
| 77 // TODO(pneubeck): Use ProfileHelper to obtain the userhash, once it provides |
| 78 // that functionality. crbug/238623. |
| 79 std::string userhash = requesting_profile->GetPath().BaseName().value(); |
| 80 |
| 74 ManagedNetworkConfigurationHandler::Get()->GetManagedProperties( | 81 ManagedNetworkConfigurationHandler::Get()->GetManagedProperties( |
| 82 userhash, |
| 75 params->network_guid, // service path | 83 params->network_guid, // service path |
| 76 base::Bind(&NetworkingPrivateGetManagedPropertiesFunction::Success, | 84 base::Bind(&NetworkingPrivateGetManagedPropertiesFunction::Success, |
| 77 this), | 85 this), |
| 78 base::Bind(&NetworkingPrivateGetManagedPropertiesFunction::Failure, | 86 base::Bind(&NetworkingPrivateGetManagedPropertiesFunction::Failure, |
| 79 this)); | 87 this)); |
| 80 return true; | 88 return true; |
| 81 } | 89 } |
| 82 | 90 |
| 83 void NetworkingPrivateGetManagedPropertiesFunction::Success( | 91 void NetworkingPrivateGetManagedPropertiesFunction::Success( |
| 84 const std::string& service_path, | 92 const std::string& service_path, |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 const std::string& result) { | 410 const std::string& result) { |
| 403 results_ = api::VerifyAndEncryptData::Results::Create(result); | 411 results_ = api::VerifyAndEncryptData::Results::Create(result); |
| 404 SendResponse(true); | 412 SendResponse(true); |
| 405 } | 413 } |
| 406 | 414 |
| 407 void NetworkingPrivateVerifyAndEncryptDataFunction::ErrorCallback( | 415 void NetworkingPrivateVerifyAndEncryptDataFunction::ErrorCallback( |
| 408 const std::string& error_name, const std::string& error) { | 416 const std::string& error_name, const std::string& error) { |
| 409 error_ = error_name; | 417 error_ = error_name; |
| 410 SendResponse(false); | 418 SendResponse(false); |
| 411 } | 419 } |
| OLD | NEW |