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

Side by Side Diff: chromeos/network/managed_network_configuration_handler.h

Issue 12676017: Adding policy support to the new network configuration stack. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add comments to local helper functions and fixed some nits. Created 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 #ifndef CHROMEOS_NETWORK_MANAGED_NETWORK_CONFIGURATION_HANDLER_H_ 5 #ifndef CHROMEOS_NETWORK_MANAGED_NETWORK_CONFIGURATION_HANDLER_H_
6 #define CHROMEOS_NETWORK_MANAGED_NETWORK_CONFIGURATION_HANDLER_H_ 6 #define CHROMEOS_NETWORK_MANAGED_NETWORK_CONFIGURATION_HANDLER_H_
7 7
8 #include <map>
8 #include <string> 9 #include <string>
9 #include <vector>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/callback.h" 12 #include "base/callback.h"
13 #include "base/gtest_prod_util.h" 13 #include "base/gtest_prod_util.h"
14 #include "base/memory/weak_ptr.h"
14 #include "chromeos/chromeos_export.h" 15 #include "chromeos/chromeos_export.h"
15 #include "chromeos/network/network_handler_callbacks.h" 16 #include "chromeos/network/network_handler_callbacks.h"
17 #include "chromeos/network/onc/onc_constants.h"
16 18
17 namespace base { 19 namespace base {
18 class DictionaryValue; 20 class DictionaryValue;
19 } 21 }
20 22
21 namespace chromeos { 23 namespace chromeos {
22 24
23 // The ManagedNetworkConfigurationHandler class is used to create and configure 25 // The ManagedNetworkConfigurationHandler class is used to create and configure
24 // networks in ChromeOS using ONC. 26 // networks in ChromeOS using ONC.
25 // 27 //
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 62
61 // Initialize() must be called before this. 63 // Initialize() must be called before this.
62 static ManagedNetworkConfigurationHandler* Get(); 64 static ManagedNetworkConfigurationHandler* Get();
63 65
64 // Provides the properties of the network with |service_path| to |callback|. 66 // Provides the properties of the network with |service_path| to |callback|.
65 void GetProperties( 67 void GetProperties(
66 const std::string& service_path, 68 const std::string& service_path,
67 const network_handler::DictionaryResultCallback& callback, 69 const network_handler::DictionaryResultCallback& callback,
68 const network_handler::ErrorCallback& error_callback) const; 70 const network_handler::ErrorCallback& error_callback) const;
69 71
72 // Provides the managed properties of the network with |service_path| to
73 // |callback|.
74 void GetManagedProperties(
75 const std::string& service_path,
76 const network_handler::DictionaryResultCallback& callback,
77 const network_handler::ErrorCallback& error_callback);
78
70 // Sets the user's settings of an already configured network with 79 // Sets the user's settings of an already configured network with
71 // |service_path|. A network can be initially configured by calling 80 // |service_path|. A network can be initially configured by calling
72 // CreateConfiguration or if it is managed by a policy. The given properties 81 // CreateConfiguration or if it is managed by a policy. The given properties
73 // will be merged with the existing settings, and it won't clear any existing 82 // will be merged with the existing settings, and it won't clear any existing
74 // properties. 83 // properties.
75 void SetProperties( 84 void SetProperties(
76 const std::string& service_path, 85 const std::string& service_path,
77 const base::DictionaryValue& properties, 86 const base::DictionaryValue& user_settings,
78 const base::Closure& callback, 87 const base::Closure& callback,
79 const network_handler::ErrorCallback& error_callback) const; 88 const network_handler::ErrorCallback& error_callback) const;
80 89
81 // Initiates a connection with network that has |service_path|. |callback| is 90 // Initiates a connection with network that has |service_path|. |callback| is
82 // called if the connection request was successfully handled. That doesn't 91 // called if the connection request was successfully handled. That doesn't
83 // mean that the connection was successfully established. 92 // mean that the connection was successfully established.
84 void Connect(const std::string& service_path, 93 void Connect(const std::string& service_path,
85 const base::Closure& callback, 94 const base::Closure& callback,
86 const network_handler::ErrorCallback& error_callback) const; 95 const network_handler::ErrorCallback& error_callback) const;
87 96
(...skipping 14 matching lines...) Expand all
102 const network_handler::ErrorCallback& error_callback) const; 111 const network_handler::ErrorCallback& error_callback) const;
103 112
104 // Removes the user's configuration from the network with |service_path|. The 113 // Removes the user's configuration from the network with |service_path|. The
105 // network may still show up in the visible networks after this, but no user 114 // network may still show up in the visible networks after this, but no user
106 // configuration will remain. If it was managed, it will still be configured. 115 // configuration will remain. If it was managed, it will still be configured.
107 void RemoveConfiguration( 116 void RemoveConfiguration(
108 const std::string& service_path, 117 const std::string& service_path,
109 const base::Closure& callback, 118 const base::Closure& callback,
110 const network_handler::ErrorCallback& error_callback) const; 119 const network_handler::ErrorCallback& error_callback) const;
111 120
121 // Only to be called by NetworkConfigurationUpdater.
122 void SetPolicy(onc::ONCSource onc_source,
123 const base::DictionaryValue& onc_dict);
124
112 private: 125 private:
126 typedef std::map<std::string, const base::DictionaryValue*> PolicyMap;
127
128 class PolicyApplicator;
129
113 ManagedNetworkConfigurationHandler(); 130 ManagedNetworkConfigurationHandler();
114 ~ManagedNetworkConfigurationHandler(); 131 ~ManagedNetworkConfigurationHandler();
115 132
133 void GetManagedPropertiesCallback(
134 const network_handler::DictionaryResultCallback& callback,
135 const network_handler::ErrorCallback& error_callback,
136 const std::string& service_path,
137 const base::DictionaryValue& shill_properties);
138
139 const PolicyMap &GetPoliciesForProfile(const std::string& profile) const;
140
141 bool user_policy_initialized_;
142 bool device_policy_initialized_;
143
144 PolicyMap user_policies_by_guid_;
145 PolicyMap device_policies_by_guid_;
146
147 // For Shill client callbacks
148 base::WeakPtrFactory<ManagedNetworkConfigurationHandler> weak_ptr_factory_;
149
116 DISALLOW_COPY_AND_ASSIGN(ManagedNetworkConfigurationHandler); 150 DISALLOW_COPY_AND_ASSIGN(ManagedNetworkConfigurationHandler);
117 }; 151 };
118 152
119 } // namespace chromeos 153 } // namespace chromeos
120 154
121 #endif // CHROMEOS_NETWORK_MANAGED_NETWORK_CONFIGURATION_HANDLER_H_ 155 #endif // CHROMEOS_NETWORK_MANAGED_NETWORK_CONFIGURATION_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698