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

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

Issue 2620463003: Add getGlobalPolicy to networkingPrivate API. (Closed)
Patch Set: Add dcheck 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_chromeos. h" 5 #include "extensions/browser/api/networking_private/networking_private_chromeos. h"
6 6
7 #include <memory> 7 #include <memory>
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 655 matching lines...) Expand 10 before | Expand all | Expand 10 after
666 ::onc::network_type::kWimax, ::onc::network_type::kCellular}; 666 ::onc::network_type::kWimax, ::onc::network_type::kCellular};
667 for (const char* technology : technology_types) { 667 for (const char* technology : technology_types) {
668 if (base::ContainsValue(technologies_found, technology)) 668 if (base::ContainsValue(technologies_found, technology))
669 continue; 669 continue;
670 AppendDeviceState(technology, nullptr /* device */, 670 AppendDeviceState(technology, nullptr /* device */,
671 device_state_list.get()); 671 device_state_list.get());
672 } 672 }
673 return device_state_list; 673 return device_state_list;
674 } 674 }
675 675
676 std::unique_ptr<base::DictionaryValue>
677 NetworkingPrivateChromeOS::GetGlobalPolicy() {
678 auto result = base::MakeUnique<base::DictionaryValue>();
679 const base::DictionaryValue* global_network_config =
680 GetManagedConfigurationHandler()->GetGlobalConfigFromPolicy(
681 std::string() /* no username hash, device policy */);
682 if (global_network_config)
683 result->MergeDictionary(global_network_config);
684 return result;
685 }
686
676 bool NetworkingPrivateChromeOS::EnableNetworkType(const std::string& type) { 687 bool NetworkingPrivateChromeOS::EnableNetworkType(const std::string& type) {
677 NetworkTypePattern pattern = 688 NetworkTypePattern pattern =
678 chromeos::onc::NetworkTypePatternFromOncType(type); 689 chromeos::onc::NetworkTypePatternFromOncType(type);
679 690
680 GetStateHandler()->SetTechnologyEnabled( 691 GetStateHandler()->SetTechnologyEnabled(
681 pattern, true, chromeos::network_handler::ErrorCallback()); 692 pattern, true, chromeos::network_handler::ErrorCallback());
682 693
683 return true; 694 return true;
684 } 695 }
685 696
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
819 // Eventually the caller (e.g. Settings) should handle any failures and 830 // Eventually the caller (e.g. Settings) should handle any failures and
820 // show its own configuration UI. crbug.com/380937. 831 // show its own configuration UI. crbug.com/380937.
821 if (ui_delegate()->HandleConnectFailed(guid, error_name)) { 832 if (ui_delegate()->HandleConnectFailed(guid, error_name)) {
822 success_callback.Run(); 833 success_callback.Run();
823 return; 834 return;
824 } 835 }
825 failure_callback.Run(error_name); 836 failure_callback.Run(error_name);
826 } 837 }
827 838
828 } // namespace extensions 839 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698