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

Side by Side Diff: extensions/browser/api/networking_private/networking_private_api.cc

Issue 2815343002: Enable networking.onc for stable channel (Closed)
Patch Set: Created 3 years, 8 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
« no previous file with comments | « no previous file | extensions/common/api/_permission_features.json » ('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 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 625 matching lines...) Expand 10 before | Expand all | Expand 10 after
636 636
637 //////////////////////////////////////////////////////////////////////////////// 637 ////////////////////////////////////////////////////////////////////////////////
638 // NetworkingPrivateStartActivateFunction 638 // NetworkingPrivateStartActivateFunction
639 639
640 NetworkingPrivateStartActivateFunction:: 640 NetworkingPrivateStartActivateFunction::
641 ~NetworkingPrivateStartActivateFunction() { 641 ~NetworkingPrivateStartActivateFunction() {
642 } 642 }
643 643
644 ExtensionFunction::ResponseAction 644 ExtensionFunction::ResponseAction
645 NetworkingPrivateStartActivateFunction::Run() { 645 NetworkingPrivateStartActivateFunction::Run() {
646 if (!HasPrivateNetworkingAccess(extension(), source_context_type(),
647 source_url())) {
648 return RespondNow(Error(kPrivateOnlyError));
649 }
650
646 std::unique_ptr<private_api::StartActivate::Params> params = 651 std::unique_ptr<private_api::StartActivate::Params> params =
647 private_api::StartActivate::Params::Create(*args_); 652 private_api::StartActivate::Params::Create(*args_);
648 EXTENSION_FUNCTION_VALIDATE(params); 653 EXTENSION_FUNCTION_VALIDATE(params);
649 654
650 GetDelegate(browser_context()) 655 GetDelegate(browser_context())
651 ->StartActivate( 656 ->StartActivate(
652 params->network_guid, params->carrier ? *params->carrier : "", 657 params->network_guid, params->carrier ? *params->carrier : "",
653 base::Bind(&NetworkingPrivateStartActivateFunction::Success, this), 658 base::Bind(&NetworkingPrivateStartActivateFunction::Success, this),
654 base::Bind(&NetworkingPrivateStartActivateFunction::Failure, this)); 659 base::Bind(&NetworkingPrivateStartActivateFunction::Failure, this));
655 // Success() or Failure() might have been called synchronously at this point. 660 // Success() or Failure() might have been called synchronously at this point.
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
938 } 943 }
939 944
940 //////////////////////////////////////////////////////////////////////////////// 945 ////////////////////////////////////////////////////////////////////////////////
941 // NetworkingPrivateUnlockCellularSimFunction 946 // NetworkingPrivateUnlockCellularSimFunction
942 947
943 NetworkingPrivateUnlockCellularSimFunction:: 948 NetworkingPrivateUnlockCellularSimFunction::
944 ~NetworkingPrivateUnlockCellularSimFunction() {} 949 ~NetworkingPrivateUnlockCellularSimFunction() {}
945 950
946 ExtensionFunction::ResponseAction 951 ExtensionFunction::ResponseAction
947 NetworkingPrivateUnlockCellularSimFunction::Run() { 952 NetworkingPrivateUnlockCellularSimFunction::Run() {
953 if (!HasPrivateNetworkingAccess(extension(), source_context_type(),
954 source_url())) {
955 return RespondNow(Error(kPrivateOnlyError));
956 }
957
948 std::unique_ptr<private_api::UnlockCellularSim::Params> params = 958 std::unique_ptr<private_api::UnlockCellularSim::Params> params =
949 private_api::UnlockCellularSim::Params::Create(*args_); 959 private_api::UnlockCellularSim::Params::Create(*args_);
950 EXTENSION_FUNCTION_VALIDATE(params); 960 EXTENSION_FUNCTION_VALIDATE(params);
951 961
952 GetDelegate(browser_context()) 962 GetDelegate(browser_context())
953 ->UnlockCellularSim( 963 ->UnlockCellularSim(
954 params->network_guid, params->pin, params->puk ? *params->puk : "", 964 params->network_guid, params->pin, params->puk ? *params->puk : "",
955 base::Bind(&NetworkingPrivateUnlockCellularSimFunction::Success, 965 base::Bind(&NetworkingPrivateUnlockCellularSimFunction::Success,
956 this), 966 this),
957 base::Bind(&NetworkingPrivateUnlockCellularSimFunction::Failure, 967 base::Bind(&NetworkingPrivateUnlockCellularSimFunction::Failure,
(...skipping 14 matching lines...) Expand all
972 } 982 }
973 983
974 //////////////////////////////////////////////////////////////////////////////// 984 ////////////////////////////////////////////////////////////////////////////////
975 // NetworkingPrivateSetCellularSimStateFunction 985 // NetworkingPrivateSetCellularSimStateFunction
976 986
977 NetworkingPrivateSetCellularSimStateFunction:: 987 NetworkingPrivateSetCellularSimStateFunction::
978 ~NetworkingPrivateSetCellularSimStateFunction() {} 988 ~NetworkingPrivateSetCellularSimStateFunction() {}
979 989
980 ExtensionFunction::ResponseAction 990 ExtensionFunction::ResponseAction
981 NetworkingPrivateSetCellularSimStateFunction::Run() { 991 NetworkingPrivateSetCellularSimStateFunction::Run() {
992 if (!HasPrivateNetworkingAccess(extension(), source_context_type(),
993 source_url())) {
994 return RespondNow(Error(kPrivateOnlyError));
995 }
996
982 std::unique_ptr<private_api::SetCellularSimState::Params> params = 997 std::unique_ptr<private_api::SetCellularSimState::Params> params =
983 private_api::SetCellularSimState::Params::Create(*args_); 998 private_api::SetCellularSimState::Params::Create(*args_);
984 EXTENSION_FUNCTION_VALIDATE(params); 999 EXTENSION_FUNCTION_VALIDATE(params);
985 1000
986 GetDelegate(browser_context()) 1001 GetDelegate(browser_context())
987 ->SetCellularSimState( 1002 ->SetCellularSimState(
988 params->network_guid, params->sim_state.require_pin, 1003 params->network_guid, params->sim_state.require_pin,
989 params->sim_state.current_pin, 1004 params->sim_state.current_pin,
990 params->sim_state.new_pin ? *params->sim_state.new_pin : "", 1005 params->sim_state.new_pin ? *params->sim_state.new_pin : "",
991 base::Bind(&NetworkingPrivateSetCellularSimStateFunction::Success, 1006 base::Bind(&NetworkingPrivateSetCellularSimStateFunction::Success,
(...skipping 29 matching lines...) Expand all
1021 // private_api::GlobalPolicy is a subset of the global policy dictionary 1036 // private_api::GlobalPolicy is a subset of the global policy dictionary
1022 // (by definition), so use the api setter/getter to generate the subset. 1037 // (by definition), so use the api setter/getter to generate the subset.
1023 std::unique_ptr<private_api::GlobalPolicy> policy( 1038 std::unique_ptr<private_api::GlobalPolicy> policy(
1024 private_api::GlobalPolicy::FromValue(*policy_dict)); 1039 private_api::GlobalPolicy::FromValue(*policy_dict));
1025 DCHECK(policy); 1040 DCHECK(policy);
1026 return RespondNow( 1041 return RespondNow(
1027 ArgumentList(private_api::GetGlobalPolicy::Results::Create(*policy))); 1042 ArgumentList(private_api::GetGlobalPolicy::Results::Create(*policy)));
1028 } 1043 }
1029 1044
1030 } // namespace extensions 1045 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | extensions/common/api/_permission_features.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698