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

Unified Diff: chromeos/network/network_ui_data.h

Issue 13454006: Moving ManagedNetworkConfigurationHandler to chromeos/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleaned up parsing of NetworkUIData. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chromeos/network/managed_network_configuration_handler.cc ('k') | chromeos/network/network_ui_data.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/network/network_ui_data.h
diff --git a/chrome/browser/chromeos/cros/network_ui_data.h b/chromeos/network/network_ui_data.h
similarity index 50%
rename from chrome/browser/chromeos/cros/network_ui_data.h
rename to chromeos/network/network_ui_data.h
index aa16974d9cbbeeb3fb13767b0f7a07b64c6b498b..2c93a9fd6ebb7c5d13ac58fd94b70ca31b63c695 100644
--- a/chrome/browser/chromeos/cros/network_ui_data.h
+++ b/chromeos/network/network_ui_data.h
@@ -2,21 +2,29 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_CHROMEOS_CROS_NETWORK_UI_DATA_H_
-#define CHROME_BROWSER_CHROMEOS_CROS_NETWORK_UI_DATA_H_
+#ifndef CHROMEOS_NETWORK_NETWORK_UI_DATA_H_
+#define CHROMEOS_NETWORK_NETWORK_UI_DATA_H_
#include <string>
#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
-#include "base/values.h"
-#include "chrome/browser/chromeos/cros/certificate_pattern.h"
-#include "chrome/browser/chromeos/cros/enum_mapper.h"
-#include "chrome/browser/chromeos/cros/network_constants.h"
+#include "chromeos/chromeos_export.h"
+#include "chromeos/network/certificate_pattern.h"
#include "chromeos/network/onc/onc_constants.h"
+namespace base {
+class DictionaryValue;
+}
+
namespace chromeos {
+enum ClientCertType {
+ CLIENT_CERT_TYPE_NONE = 0,
+ CLIENT_CERT_TYPE_REF = 1,
+ CLIENT_CERT_TYPE_PATTERN = 2
+};
+
class NetworkPropertyUIData;
// Helper for accessing and setting values in the network's UI data dictionary.
@@ -28,7 +36,7 @@ class NetworkPropertyUIData;
// NetworkUIData ui_data;
// ui_data.set_onc_source(onc::ONC_SOURCE_USER_IMPORT);
// ui_data.FillDictionary(network->ui_data());
-class NetworkUIData {
+class CHROMEOS_EXPORT NetworkUIData {
public:
NetworkUIData();
explicit NetworkUIData(const base::DictionaryValue& dict);
@@ -70,67 +78,20 @@ class NetworkUIData {
static const char kKeyCertificateType[];
private:
- static EnumMapper<onc::ONCSource>& GetONCSourceMapper();
- static EnumMapper<ClientCertType>& GetClientCertMapper();
-
CertificatePattern certificate_pattern_;
onc::ONCSource onc_source_;
ClientCertType certificate_type_;
-
- static const EnumMapper<onc::ONCSource>::Pair kONCSourceTable[];
- static const EnumMapper<ClientCertType>::Pair kClientCertTable[];
};
-// Holds meta information for a network property: Whether the property is under
-// policy control, if it is user-editable, and whether the policy-provided
-// default value, if applicable.
-class NetworkPropertyUIData {
- public:
- // Enum values indicating the entity controlling the property.
- enum Controller {
- // Property is managed by policy.
- CONTROLLER_POLICY,
- // The user controls the policy.
- CONTROLLER_USER,
- };
-
- // Initializes the object with CONTROLLER_USER and no default value.
- NetworkPropertyUIData();
- ~NetworkPropertyUIData();
-
- // Initializes the object by calling Reset() with the provided ui_data.
- explicit NetworkPropertyUIData(const NetworkUIData& ui_data);
-
- // Resets the property to the controller specified by the given |ui_data| and
- // clears the default value.
- void Reset(const NetworkUIData& ui_data);
-
- // Update the property object from dictionary, reading the key given by
- // |property_key|.
- void ParseOncProperty(const NetworkUIData& ui_data,
- const base::DictionaryValue* onc,
- const std::string& property_key);
-
- const base::Value* default_value() const { return default_value_.get(); }
- bool managed() const { return controller_ == CONTROLLER_POLICY; }
- bool recommended() const {
- return controller_ == CONTROLLER_USER && default_value_.get();
- }
- bool editable() const { return controller_ == CONTROLLER_USER; }
-
- private:
- Controller controller_;
- scoped_ptr<base::Value> default_value_;
-
- static const char kKeyController[];
- static const char kKeyDefaultValue[];
-
- // So it can access the kKeyXYZ constants.
- friend class NetworkUIDataTest;
-
- DISALLOW_COPY_AND_ASSIGN(NetworkPropertyUIData);
-};
+// Creates a NetworkUIData object from |onc_network|, which has to be a valid
+// ONC NetworkConfiguration dictionary.
+//
+// This function is used to create the "UIData" field of the Shill
+// configuration.
+CHROMEOS_EXPORT scoped_ptr<NetworkUIData> CreateUIDataFromONC(
+ onc::ONCSource onc_source,
+ const base::DictionaryValue& onc_network);
} // namespace chromeos
-#endif // CHROME_BROWSER_CHROMEOS_CROS_NETWORK_UI_DATA_H_
+#endif // CHROMEOS_NETWORK_NETWORK_UI_DATA_H_
« no previous file with comments | « chromeos/network/managed_network_configuration_handler.cc ('k') | chromeos/network/network_ui_data.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698