OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/browser/api/networking_private/networking_private_api.h" | 5 #include "extensions/browser/api/networking_private/networking_private_api.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 | 265 |
266 ExtensionFunction::ResponseAction | 266 ExtensionFunction::ResponseAction |
267 NetworkingPrivateForgetNetworkFunction::Run() { | 267 NetworkingPrivateForgetNetworkFunction::Run() { |
268 std::unique_ptr<private_api::ForgetNetwork::Params> params = | 268 std::unique_ptr<private_api::ForgetNetwork::Params> params = |
269 private_api::ForgetNetwork::Params::Create(*args_); | 269 private_api::ForgetNetwork::Params::Create(*args_); |
270 EXTENSION_FUNCTION_VALIDATE(params); | 270 EXTENSION_FUNCTION_VALIDATE(params); |
271 | 271 |
272 GetDelegate(browser_context()) | 272 GetDelegate(browser_context()) |
273 ->ForgetNetwork( | 273 ->ForgetNetwork( |
274 params->network_guid, | 274 params->network_guid, |
| 275 CanChangeSharedConfig(extension(), source_context_type()), |
275 base::Bind(&NetworkingPrivateForgetNetworkFunction::Success, this), | 276 base::Bind(&NetworkingPrivateForgetNetworkFunction::Success, this), |
276 base::Bind(&NetworkingPrivateForgetNetworkFunction::Failure, this)); | 277 base::Bind(&NetworkingPrivateForgetNetworkFunction::Failure, this)); |
277 // Success() or Failure() might have been called synchronously at this point. | 278 // Success() or Failure() might have been called synchronously at this point. |
278 // In that case this function has already called Respond(). Return | 279 // In that case this function has already called Respond(). Return |
279 // AlreadyResponded() in that case. | 280 // AlreadyResponded() in that case. |
280 return did_respond() ? AlreadyResponded() : RespondLater(); | 281 return did_respond() ? AlreadyResponded() : RespondLater(); |
281 } | 282 } |
282 | 283 |
283 void NetworkingPrivateForgetNetworkFunction::Success() { | 284 void NetworkingPrivateForgetNetworkFunction::Success() { |
284 Respond(NoArguments()); | 285 Respond(NoArguments()); |
(...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
945 // private_api::GlobalPolicy is a subset of the global policy dictionary | 946 // private_api::GlobalPolicy is a subset of the global policy dictionary |
946 // (by definition), so use the api setter/getter to generate the subset. | 947 // (by definition), so use the api setter/getter to generate the subset. |
947 std::unique_ptr<private_api::GlobalPolicy> policy( | 948 std::unique_ptr<private_api::GlobalPolicy> policy( |
948 private_api::GlobalPolicy::FromValue(*policy_dict)); | 949 private_api::GlobalPolicy::FromValue(*policy_dict)); |
949 DCHECK(policy); | 950 DCHECK(policy); |
950 return RespondNow( | 951 return RespondNow( |
951 ArgumentList(private_api::GetGlobalPolicy::Results::Create(*policy))); | 952 ArgumentList(private_api::GetGlobalPolicy::Results::Create(*policy))); |
952 } | 953 } |
953 | 954 |
954 } // namespace extensions | 955 } // namespace extensions |
OLD | NEW |