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

Unified Diff: chrome/browser/chromeos/cros/network_property_ui_data.h

Issue 14846004: Migrate ProxyConfigServiceImpl to NetworkStateHandler and NetworkProfileHandler. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased. 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/cros/network_property_ui_data.h
diff --git a/chrome/browser/chromeos/cros/network_property_ui_data.h b/chrome/browser/chromeos/cros/network_property_ui_data.h
index d905a407c46932152851da159861c37d80e03063..a49f929e8d8c87d29d900d00fad0d0475b2a69da 100644
--- a/chrome/browser/chromeos/cros/network_property_ui_data.h
+++ b/chrome/browser/chromeos/cros/network_property_ui_data.h
@@ -9,6 +9,7 @@
#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
+#include "chromeos/network/onc/onc_constants.h"
namespace base {
class DictionaryValue;
@@ -17,8 +18,6 @@ class Value;
namespace chromeos {
-class NetworkUIData;
-
// 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.
@@ -37,34 +36,31 @@ class 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);
+ explicit NetworkPropertyUIData(onc::ONCSource onc_source);
// Update the property object from dictionary, reading the key given by
// |property_key|.
- void ParseOncProperty(const NetworkUIData& ui_data,
+ void ParseOncProperty(onc::ONCSource onc_source,
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 managed() const {
+ return (onc_source_ == onc::ONC_SOURCE_DEVICE_POLICY ||
+ onc_source_ == onc::ONC_SOURCE_USER_POLICY);
+ }
bool recommended() const {
- return controller_ == CONTROLLER_USER && default_value_.get();
+ return !managed() && default_value_.get();
}
- bool editable() const { return controller_ == CONTROLLER_USER; }
+ bool editable() const { return !managed(); }
private:
- Controller controller_;
- scoped_ptr<base::Value> default_value_;
-
- static const char kKeyController[];
- static const char kKeyDefaultValue[];
+ // Resets the property to the controller specified by the given |ui_data| and
+ // clears the default value.
+ void Reset(onc::ONCSource onc_source);
- // So it can access the kKeyXYZ constants.
- friend class NetworkUIDataTest;
+ onc::ONCSource onc_source_;
+ scoped_ptr<base::Value> default_value_;
DISALLOW_COPY_AND_ASSIGN(NetworkPropertyUIData);
};

Powered by Google App Engine
This is Rietveld 408576698