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

Unified Diff: components/cloud_devices/cloud_device_description.cc

Issue 166283002: "Privet" Printing reads DPI for PWG raster conversion from device capabilities. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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/cloud_device_description.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/cloud_devices/cloud_device_description.cc
diff --git a/components/cloud_devices/cloud_device_description.cc b/components/cloud_devices/cloud_device_description.cc
index 124bb49c1fd3a429aaeeaaf978f7e0745191650b..baf544ddcc3173f057c40c392c2115adc7793c03 100644
--- a/components/cloud_devices/cloud_device_description.cc
+++ b/components/cloud_devices/cloud_device_description.cc
@@ -24,19 +24,24 @@ void CloudDeviceDescription::Reset() {
root_->SetString(json::kVersion, json::kVersion10);
}
-bool CloudDeviceDescription::InitFromString(const std::string& json) {
+bool CloudDeviceDescription::InitFromDictionary(
+ scoped_ptr<base::DictionaryValue> root) {
+ if (!root)
+ return false;
Reset();
+ root_ = root.Pass();
+ std::string version;
+ root_->GetString(json::kVersion, &version);
+ return version == json::kVersion10;
+}
+bool CloudDeviceDescription::InitFromString(const std::string& json) {
scoped_ptr<base::Value> parsed(base::JSONReader::Read(json));
base::DictionaryValue* description = NULL;
if (!parsed || !parsed->GetAsDictionary(&description))
return false;
- root_.reset(description);
ignore_result(parsed.release());
-
- std::string version;
- description->GetString(json::kVersion, &version);
- return version == json::kVersion10;
+ return InitFromDictionary(make_scoped_ptr(description));
}
std::string CloudDeviceDescription::ToString() const {
« no previous file with comments | « components/cloud_devices/cloud_device_description.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698