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

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

Issue 10868076: Only import certificates with Web trust from ONC if the user is managed and matches the enterprise … (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebaesd Created 8 years, 3 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
11 #include "chrome/browser/chromeos/cros/network_library.h" 11 #include "chrome/browser/chromeos/cros/network_library.h"
12 #include "chrome/browser/policy/policy_map.h" 12 #include "chrome/browser/policy/policy_map.h"
13 #include "policy/policy_constants.h" 13 #include "policy/policy_constants.h"
14 14
15 namespace policy { 15 namespace policy {
16 16
17 const char NetworkConfigurationUpdater::kEmptyConfiguration[] = 17 const char NetworkConfigurationUpdater::kEmptyConfiguration[] =
18 "{\"NetworkConfigurations\":[],\"Certificates\":[]}"; 18 "{\"NetworkConfigurations\":[],\"Certificates\":[]}";
19 19
20 NetworkConfigurationUpdater::NetworkConfigurationUpdater( 20 NetworkConfigurationUpdater::NetworkConfigurationUpdater(
21 PolicyService* policy_service, 21 PolicyService* policy_service,
22 chromeos::NetworkLibrary* network_library) 22 chromeos::NetworkLibrary* network_library)
23 : policy_change_registrar_( 23 : policy_change_registrar_(
24 policy_service, POLICY_DOMAIN_CHROME, std::string()), 24 policy_service, POLICY_DOMAIN_CHROME, std::string()),
25 network_library_(network_library) { 25 network_library_(network_library),
26 allow_web_trust_(false) {
26 DCHECK(network_library_); 27 DCHECK(network_library_);
27 policy_change_registrar_.Observe( 28 policy_change_registrar_.Observe(
28 key::kDeviceOpenNetworkConfiguration, 29 key::kDeviceOpenNetworkConfiguration,
29 base::Bind(&NetworkConfigurationUpdater::ApplyNetworkConfiguration, 30 base::Bind(&NetworkConfigurationUpdater::ApplyNetworkConfiguration,
30 base::Unretained(this), 31 base::Unretained(this),
31 chromeos::NetworkUIData::ONC_SOURCE_DEVICE_POLICY, 32 chromeos::NetworkUIData::ONC_SOURCE_DEVICE_POLICY,
32 &device_network_config_)); 33 &device_network_config_));
33 policy_change_registrar_.Observe( 34 policy_change_registrar_.Observe(
34 key::kOpenNetworkConfiguration, 35 key::kOpenNetworkConfiguration,
35 base::Bind(&NetworkConfigurationUpdater::ApplyNetworkConfiguration, 36 base::Bind(&NetworkConfigurationUpdater::ApplyNetworkConfiguration,
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 // We need to load an empty configuration to get rid of any configuration 71 // We need to load an empty configuration to get rid of any configuration
71 // that has been installed previously. An empty string also works, but 72 // that has been installed previously. An empty string also works, but
72 // generates warnings and errors, which we'd like to avoid. 73 // generates warnings and errors, which we'd like to avoid.
73 if (new_network_config.empty()) 74 if (new_network_config.empty())
74 new_network_config = kEmptyConfiguration; 75 new_network_config = kEmptyConfiguration;
75 76
76 if (*cached_value != new_network_config) { 77 if (*cached_value != new_network_config) {
77 *cached_value = new_network_config; 78 *cached_value = new_network_config;
78 std::string error; 79 std::string error;
79 if (!network_library_->LoadOncNetworks(new_network_config, "", onc_source, 80 if (!network_library_->LoadOncNetworks(new_network_config, "", onc_source,
80 &error)) { 81 allow_web_trust_, &error)) {
81 LOG(WARNING) << "Network library failed to load ONC configuration:" 82 LOG(WARNING) << "Network library failed to load ONC configuration:"
82 << error; 83 << error;
83 } 84 }
84 } 85 }
85 } 86 }
86 87
87 } // namespace policy 88 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/policy/network_configuration_updater.h ('k') | chrome/browser/policy/network_configuration_updater_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698