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

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

Issue 1038873004: Convert networkingPrivate to use IDL format (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@issue_470282_onc_cellular_technology
Patch Set: Created 5 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
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 "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 "components/onc/onc_constants.h" 10 #include "components/onc/onc_constants.h"
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 139
140 NetworkingPrivateSetPropertiesFunction:: 140 NetworkingPrivateSetPropertiesFunction::
141 ~NetworkingPrivateSetPropertiesFunction() { 141 ~NetworkingPrivateSetPropertiesFunction() {
142 } 142 }
143 143
144 bool NetworkingPrivateSetPropertiesFunction::RunAsync() { 144 bool NetworkingPrivateSetPropertiesFunction::RunAsync() {
145 scoped_ptr<private_api::SetProperties::Params> params = 145 scoped_ptr<private_api::SetProperties::Params> params =
146 private_api::SetProperties::Params::Create(*args_); 146 private_api::SetProperties::Params::Create(*args_);
147 EXTENSION_FUNCTION_VALIDATE(params); 147 EXTENSION_FUNCTION_VALIDATE(params);
148 148
149 // TODO(stevenjb): Switch this back to params->properties.ToValue() once we
150 // introduce types to the IDL. crbug.com/470262.
149 scoped_ptr<base::DictionaryValue> properties_dict( 151 scoped_ptr<base::DictionaryValue> properties_dict(
150 params->properties.ToValue()); 152 params->properties.additional_properties.DeepCopy());
151 153
152 GetDelegate(browser_context()) 154 GetDelegate(browser_context())
153 ->SetProperties( 155 ->SetProperties(
154 params->network_guid, properties_dict.Pass(), 156 params->network_guid, properties_dict.Pass(),
155 base::Bind(&NetworkingPrivateSetPropertiesFunction::Success, this), 157 base::Bind(&NetworkingPrivateSetPropertiesFunction::Success, this),
156 base::Bind(&NetworkingPrivateSetPropertiesFunction::Failure, this)); 158 base::Bind(&NetworkingPrivateSetPropertiesFunction::Failure, this));
157 return true; 159 return true;
158 } 160 }
159 161
160 void NetworkingPrivateSetPropertiesFunction::Success() { 162 void NetworkingPrivateSetPropertiesFunction::Success() {
(...skipping 10 matching lines...) Expand all
171 173
172 NetworkingPrivateCreateNetworkFunction:: 174 NetworkingPrivateCreateNetworkFunction::
173 ~NetworkingPrivateCreateNetworkFunction() { 175 ~NetworkingPrivateCreateNetworkFunction() {
174 } 176 }
175 177
176 bool NetworkingPrivateCreateNetworkFunction::RunAsync() { 178 bool NetworkingPrivateCreateNetworkFunction::RunAsync() {
177 scoped_ptr<private_api::CreateNetwork::Params> params = 179 scoped_ptr<private_api::CreateNetwork::Params> params =
178 private_api::CreateNetwork::Params::Create(*args_); 180 private_api::CreateNetwork::Params::Create(*args_);
179 EXTENSION_FUNCTION_VALIDATE(params); 181 EXTENSION_FUNCTION_VALIDATE(params);
180 182
183 // TODO(stevenjb): Switch this back to params->properties.ToValue() once we
184 // introduce types to the IDL. crbug.com/470262.
181 scoped_ptr<base::DictionaryValue> properties_dict( 185 scoped_ptr<base::DictionaryValue> properties_dict(
182 params->properties.ToValue()); 186 params->properties.additional_properties.DeepCopy());
183 187
184 GetDelegate(browser_context()) 188 GetDelegate(browser_context())
185 ->CreateNetwork( 189 ->CreateNetwork(
186 params->shared, properties_dict.Pass(), 190 params->shared, properties_dict.Pass(),
187 base::Bind(&NetworkingPrivateCreateNetworkFunction::Success, this), 191 base::Bind(&NetworkingPrivateCreateNetworkFunction::Success, this),
188 base::Bind(&NetworkingPrivateCreateNetworkFunction::Failure, this)); 192 base::Bind(&NetworkingPrivateCreateNetworkFunction::Failure, this));
189 return true; 193 return true;
190 } 194 }
191 195
192 void NetworkingPrivateCreateNetworkFunction::Success(const std::string& guid) { 196 void NetworkingPrivateCreateNetworkFunction::Success(const std::string& guid) {
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 SendResponse(true); 680 SendResponse(true);
677 } 681 }
678 682
679 void NetworkingPrivateGetCaptivePortalStatusFunction::Failure( 683 void NetworkingPrivateGetCaptivePortalStatusFunction::Failure(
680 const std::string& error) { 684 const std::string& error) {
681 error_ = error; 685 error_ = error;
682 SendResponse(false); 686 SendResponse(false);
683 } 687 }
684 688
685 } // namespace extensions 689 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698