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

Unified Diff: components/cloud_devices/cloud_device_description.h

Issue 150993002: Reading, writing of CDD and CJT JSON formats. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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 | « components/cloud_devices.gypi ('k') | components/cloud_devices/cloud_device_description.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/cloud_devices/cloud_device_description.h
diff --git a/components/cloud_devices/cloud_device_description.h b/components/cloud_devices/cloud_device_description.h
new file mode 100644
index 0000000000000000000000000000000000000000..ec59c8726bcb6aade07cd316bcca5499132e63fb
--- /dev/null
+++ b/components/cloud_devices/cloud_device_description.h
@@ -0,0 +1,57 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef COMPONENTS_CLOUD_DEVICES_CLOUD_DEVICE_DESCRIPTION_H_
+#define COMPONENTS_CLOUD_DEVICES_CLOUD_DEVICE_DESCRIPTION_H_
+
+#include <string>
+
+#include "base/callback.h"
+
+namespace base {
+class DictionaryValue;
+class ListValue;
+}
+
+namespace cloud_devices {
+
+// Provides parsing, serialization and validation Cloud Device Description or
+// Cloud Job Ticket.
+// https://developers.google.com/cloud-print/docs/cdd
+class CloudDeviceDescription {
+ public:
+ CloudDeviceDescription();
+ ~CloudDeviceDescription();
+
+ void Reset();
+
+ bool InitFromString(const std::string& json);
+
+ std::string ToString() const;
+
+ // Returns dictionary with capability/option.
+ // Returns NULL if missing.
+ const base::DictionaryValue* GetItem(const std::string& path) const;
+
+ // Create dictionary for capability/option.
+ // Never returns NULL.
+ base::DictionaryValue* CreateItem(const std::string& path);
+
+ // Returns list with capability/option.
+ // Returns NULL if missing.
+ const base::ListValue* GetListItem(const std::string& path) const;
+
+ // Create list for capability/option.
+ // Never returns NULL.
+ base::ListValue* CreateListItem(const std::string& path);
+
+ private:
+ scoped_ptr<base::DictionaryValue> root_;
+
+ DISALLOW_COPY_AND_ASSIGN(CloudDeviceDescription);
+};
+
+} // namespace cloud_devices
+
+#endif // COMPONENTS_CLOUD_DEVICES_CLOUD_DEVICE_DESCRIPTION_H_
« no previous file with comments | « components/cloud_devices.gypi ('k') | components/cloud_devices/cloud_device_description.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698