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

Side by Side Diff: chrome/browser/policy/network_configuration_updater.cc

Issue 8804021: Proper management for policy-configured networks. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/browser/policy/network_configuration_updater.h" 5 #include "chrome/browser/policy/network_configuration_updater.h"
6 6
7 #include "chrome/browser/chromeos/cros/network_library.h" 7 #include "chrome/browser/chromeos/cros/network_library.h"
8 #include "chrome/browser/policy/policy_map.h" 8 #include "chrome/browser/policy/policy_map.h"
9 #include "policy/policy_constants.h" 9 #include "policy/policy_constants.h"
10 10
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 std::string* cached_value) { 50 std::string* cached_value) {
51 std::string new_network_config; 51 std::string new_network_config;
52 const base::Value* value = policy_map.Get(policy_type); 52 const base::Value* value = policy_map.Get(policy_type);
53 if (value != NULL) { 53 if (value != NULL) {
54 // If the policy is not a string, we issue a warning, but still clear the 54 // If the policy is not a string, we issue a warning, but still clear the
55 // network configuration. 55 // network configuration.
56 if (!value->GetAsString(&new_network_config)) 56 if (!value->GetAsString(&new_network_config))
57 LOG(WARNING) << "Invalid network configuration."; 57 LOG(WARNING) << "Invalid network configuration.";
58 } 58 }
59 59
60 // We need to load an empty configuration to get rid of any configuration
61 // that has been installed previously. An empty string also works, but
62 // generates warnings and errors, which we'd like to avoid.
63 if (new_network_config.empty())
64 new_network_config = "{NetworkConfigurations:[],Certificates:[]}";
65
60 if (*cached_value != new_network_config) { 66 if (*cached_value != new_network_config) {
61 *cached_value = new_network_config; 67 *cached_value = new_network_config;
62 if (!network_library_->LoadOncNetworks(new_network_config, "", onc_source)) 68 if (!network_library_->LoadOncNetworks(new_network_config, "", onc_source))
63 LOG(WARNING) << "Network library failed to load ONC configuration."; 69 LOG(WARNING) << "Network library failed to load ONC configuration.";
64 } 70 }
65 } 71 }
66 72
67 } // namespace policy 73 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698