diff options
author | vitalybuka@chromium.org <vitalybuka@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-15 03:19:08 +0000 |
---|---|---|
committer | vitalybuka@chromium.org <vitalybuka@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-15 03:19:08 +0000 |
commit | 726127fdb3582f187eda5595fab13eb49de11fb2 (patch) | |
tree | 35099ebe437dfd3c8b13f7dd237966cc46fea5f5 /components/cloud_devices | |
parent | 58956c2e50e5034734a9c79776dd37bc5af23620 (diff) | |
download | chromium_src-726127fdb3582f187eda5595fab13eb49de11fb2.zip chromium_src-726127fdb3582f187eda5595fab13eb49de11fb2.tar.gz chromium_src-726127fdb3582f187eda5595fab13eb49de11fb2.tar.bz2 |
"Privet" Printing reads DPI for PWG raster conversion from device capabilities.
BUG=343239
Review URL: https://codereview.chromium.org/166283002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@251489 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'components/cloud_devices')
-rw-r--r-- | components/cloud_devices/cloud_device_description.cc | 17 | ||||
-rw-r--r-- | components/cloud_devices/cloud_device_description.h | 1 |
2 files changed, 12 insertions, 6 deletions
diff --git a/components/cloud_devices/cloud_device_description.cc b/components/cloud_devices/cloud_device_description.cc index 124bb49..baf544d 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 { diff --git a/components/cloud_devices/cloud_device_description.h b/components/cloud_devices/cloud_device_description.h index ec59c87..d4ce081 100644 --- a/components/cloud_devices/cloud_device_description.h +++ b/components/cloud_devices/cloud_device_description.h @@ -26,6 +26,7 @@ class CloudDeviceDescription { void Reset(); + bool InitFromDictionary(scoped_ptr<base::DictionaryValue> root); bool InitFromString(const std::string& json); std::string ToString() const; |