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

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

Issue 14566009: Add NetworkConnectionHandler class (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Revert Associating Stub change for test Created 7 years, 7 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 <map>
9 #include <string> 9 #include <string>
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 "base/memory/weak_ptr.h"
15 #include "chromeos/chromeos_export.h" 15 #include "chromeos/chromeos_export.h"
16 #include "chromeos/network/network_handler_callbacks.h" 16 #include "chromeos/network/network_handler_callbacks.h"
17 #include "chromeos/network/network_profile_observer.h" 17 #include "chromeos/network/network_profile_observer.h"
18 #include "chromeos/network/onc/onc_constants.h" 18 #include "chromeos/network/onc/onc_constants.h"
19 19
20 namespace base { 20 namespace base {
21 class DictionaryValue; 21 class DictionaryValue;
22 class ListValue; 22 class ListValue;
23 } 23 }
24 24
25 namespace chromeos { 25 namespace chromeos {
26 26
27 class NetworkProfileHandler; 27 class NetworkProfileHandler;
28 class NetworkUIData;
28 29
29 // The ManagedNetworkConfigurationHandler class is used to create and configure 30 // The ManagedNetworkConfigurationHandler class is used to create and configure
30 // networks in ChromeOS using ONC and takes care of network policies. 31 // networks in ChromeOS using ONC and takes care of network policies.
31 // 32 //
32 // Its interface exposes only ONC and should decouple users from Shill. 33 // Its interface exposes only ONC and should decouple users from Shill.
33 // Internally it translates ONC to Shill dictionaries and calls through to the 34 // Internally it translates ONC to Shill dictionaries and calls through to the
34 // NetworkConfigurationHandler. 35 // NetworkConfigurationHandler.
35 // 36 //
36 // For accessing lists of visible networks, and other state information, see the 37 // For accessing lists of visible networks, and other state information, see the
37 // class NetworkStateHandler. 38 // class NetworkStateHandler.
(...skipping 24 matching lines...) Expand all
62 63
63 // Returns if the singleton is initialized. 64 // Returns if the singleton is initialized.
64 static bool IsInitialized(); 65 static bool IsInitialized();
65 66
66 // Destroys the singleton. 67 // Destroys the singleton.
67 static void Shutdown(); 68 static void Shutdown();
68 69
69 // Initialize() must be called before this. 70 // Initialize() must be called before this.
70 static ManagedNetworkConfigurationHandler* Get(); 71 static ManagedNetworkConfigurationHandler* Get();
71 72
73 // Returns the NetworkUIData parsed from the UIData property of
74 // |shill_dictionary|. If parsing fails or the field doesn't exist, returns
75 // NULL.
76 static scoped_ptr<NetworkUIData> GetUIData(
77 const base::DictionaryValue& shill_dictionary);
78
72 // Provides the properties of the network with |service_path| to |callback|. 79 // Provides the properties of the network with |service_path| to |callback|.
73 void GetProperties( 80 void GetProperties(
74 const std::string& service_path, 81 const std::string& service_path,
75 const network_handler::DictionaryResultCallback& callback, 82 const network_handler::DictionaryResultCallback& callback,
76 const network_handler::ErrorCallback& error_callback) const; 83 const network_handler::ErrorCallback& error_callback) const;
77 84
78 // Provides the managed properties of the network with |service_path| to 85 // Provides the managed properties of the network with |service_path| to
79 // |callback|. |userhash| is only used to ensure that the user's policy is 86 // |callback|. |userhash| is only used to ensure that the user's policy is
80 // already applied. 87 // already applied.
81 void GetManagedProperties( 88 void GetManagedProperties(
82 const std::string& userhash, 89 const std::string& userhash,
83 const std::string& service_path, 90 const std::string& service_path,
84 const network_handler::DictionaryResultCallback& callback, 91 const network_handler::DictionaryResultCallback& callback,
85 const network_handler::ErrorCallback& error_callback); 92 const network_handler::ErrorCallback& error_callback);
86 93
87 // Sets the user's settings of an already configured network with 94 // Sets the user's settings of an already configured network with
88 // |service_path|. A network can be initially configured by calling 95 // |service_path|. A network can be initially configured by calling
89 // CreateConfiguration or if it is managed by a policy. The given properties 96 // CreateConfiguration or if it is managed by a policy. The given properties
90 // will be merged with the existing settings, and it won't clear any existing 97 // will be merged with the existing settings, and it won't clear any existing
91 // properties. 98 // properties.
92 void SetProperties( 99 void SetProperties(
93 const std::string& service_path, 100 const std::string& service_path,
94 const base::DictionaryValue& user_settings, 101 const base::DictionaryValue& user_settings,
95 const base::Closure& callback, 102 const base::Closure& callback,
96 const network_handler::ErrorCallback& error_callback) const; 103 const network_handler::ErrorCallback& error_callback) const;
97 104
98 // Initiates a connection with network that has |service_path|. |callback| is
99 // called if the connection request was successfully handled. That doesn't
100 // mean that the connection was successfully established.
101 void Connect(const std::string& service_path,
102 const base::Closure& callback,
103 const network_handler::ErrorCallback& error_callback) const;
104
105 // Initiates a disconnect with the network at |service_path|. |callback| is
106 // called if the diconnect request was successfully handled. That doesn't mean
107 // that the network is already diconnected.
108 void Disconnect(const std::string& service_path,
109 const base::Closure& callback,
110 const network_handler::ErrorCallback& error_callback) const;
111
112 // Initially configures an unconfigured network with the given user settings 105 // Initially configures an unconfigured network with the given user settings
113 // and returns the new identifier to |callback| if successful. Fails if the 106 // and returns the new identifier to |callback| if successful. Fails if the
114 // network was already configured by a call to this function or because of a 107 // network was already configured by a call to this function or because of a
115 // policy. The new configuration will be owned by user |userhash|. If 108 // policy. The new configuration will be owned by user |userhash|. If
116 // |userhash| is empty, the new configuration will be shared. 109 // |userhash| is empty, the new configuration will be shared.
117 void CreateConfiguration( 110 void CreateConfiguration(
118 const std::string& userhash, 111 const std::string& userhash,
119 const base::DictionaryValue& properties, 112 const base::DictionaryValue& properties,
120 const network_handler::StringResultCallback& callback, 113 const network_handler::StringResultCallback& callback,
121 const network_handler::ErrorCallback& error_callback) const; 114 const network_handler::ErrorCallback& error_callback) const;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 162
170 // For Shill client callbacks 163 // For Shill client callbacks
171 base::WeakPtrFactory<ManagedNetworkConfigurationHandler> weak_ptr_factory_; 164 base::WeakPtrFactory<ManagedNetworkConfigurationHandler> weak_ptr_factory_;
172 165
173 DISALLOW_COPY_AND_ASSIGN(ManagedNetworkConfigurationHandler); 166 DISALLOW_COPY_AND_ASSIGN(ManagedNetworkConfigurationHandler);
174 }; 167 };
175 168
176 } // namespace chromeos 169 } // namespace chromeos
177 170
178 #endif // CHROMEOS_NETWORK_MANAGED_NETWORK_CONFIGURATION_HANDLER_H_ 171 #endif // CHROMEOS_NETWORK_MANAGED_NETWORK_CONFIGURATION_HANDLER_H_
OLDNEW
« no previous file with comments | « chromeos/network/certificate_pattern_matcher.cc ('k') | chromeos/network/managed_network_configuration_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698