Chromium Code Reviews| 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 761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 772 void NetworkingPrivateSetCellularSimStateFunction::Success() { | 772 void NetworkingPrivateSetCellularSimStateFunction::Success() { |
| 773 SendResponse(true); | 773 SendResponse(true); |
| 774 } | 774 } |
| 775 | 775 |
| 776 void NetworkingPrivateSetCellularSimStateFunction::Failure( | 776 void NetworkingPrivateSetCellularSimStateFunction::Failure( |
| 777 const std::string& error) { | 777 const std::string& error) { |
| 778 error_ = error; | 778 error_ = error; |
| 779 SendResponse(false); | 779 SendResponse(false); |
| 780 } | 780 } |
| 781 | 781 |
| 782 //////////////////////////////////////////////////////////////////////////////// | |
| 783 // NetworkingPrivateGetGlobalPolicyFunction | |
| 784 | |
| 785 NetworkingPrivateGetGlobalPolicyFunction:: | |
| 786 ~NetworkingPrivateGetGlobalPolicyFunction() {} | |
| 787 | |
| 788 ExtensionFunction::ResponseAction | |
| 789 NetworkingPrivateGetGlobalPolicyFunction::Run() { | |
| 790 std::unique_ptr<base::DictionaryValue> policy_dict( | |
| 791 GetDelegate(browser_context())->GetGlobalPolicy()); | |
| 792 DCHECK(policy_dict); | |
| 793 // private_api::GlobalPolicy is a subset of the global policy dictionary | |
| 794 // (by definition), so use the api setter/getter to generate the subset. | |
| 795 std::unique_ptr<private_api::GlobalPolicy> policy( | |
| 796 private_api::GlobalPolicy::FromValue(*policy_dict)); | |
|
tbarzic
2017/01/09 21:24:32
DCHECK policy is not null?
stevenjb
2017/01/09 21:48:49
Done.
| |
| 797 return RespondNow( | |
| 798 ArgumentList(private_api::GetGlobalPolicy::Results::Create(*policy))); | |
| 799 } | |
| 800 | |
| 782 } // namespace extensions | 801 } // namespace extensions |
| OLD | NEW |