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

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

Issue 2620463003: Add getGlobalPolicy to networkingPrivate API. (Closed)
Patch Set: Created 3 years, 11 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 <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
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
tbarzic 2017/01/06 22:43:17 I think explicitly setting |policy| properties mig
stevenjb 2017/01/09 19:30:37 That would effectively be duplicating the code in
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.get()));
tbarzic 2017/01/06 22:43:17 nit: .get() should not be needed.
stevenjb 2017/01/09 19:30:37 Done.
797 return RespondNow(OneArgument(policy->ToValue()));
tbarzic 2017/01/06 22:43:17 suggestion: RespondNow(ArgumentList( private_a
stevenjb 2017/01/09 19:30:37 Done.
798 }
799
782 } // namespace extensions 800 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698