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

Unified Diff: components/cloud_devices/common/printer_description.cc

Issue 325313003: Add vendor id and custom display name to media selection (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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: components/cloud_devices/common/printer_description.cc
diff --git a/components/cloud_devices/common/printer_description.cc b/components/cloud_devices/common/printer_description.cc
index 2f70fa6ce7722082b98311752e771f9f91c3c1ac..75e2554b56dd0e8defc023f6001d2ca3c5b6948f 100644
--- a/components/cloud_devices/common/printer_description.cc
+++ b/components/cloud_devices/common/printer_description.cc
@@ -460,13 +460,15 @@ Media::Media(MediaType type, int32 width_um, int32 height_um)
}
Media::Media(const std::string& custom_display_name,
+ const std::string& vendor_id,
int32 width_um,
int32 height_um)
: type(CUSTOM_MEDIA),
width_um(width_um),
height_um(height_um),
is_continuous_feed(width_um <= 0 || height_um <= 0),
- custom_display_name(custom_display_name) {
+ custom_display_name(custom_display_name),
+ vendor_id(vendor_id) {
}
bool Media::MatchBySize() {
@@ -474,7 +476,6 @@ bool Media::MatchBySize() {
if (!media)
return false;
type = media->id;
- custom_display_name.clear();
return true;
}
@@ -758,14 +759,16 @@ class MediaTraits : public ItemsTraits<kOptionMediaSize> {
dict.GetInteger(kMediaHeight, &option->height_um);
dict.GetBoolean(kMediaIsContinuous, &option->is_continuous_feed);
dict.GetString(kCustomName, &option->custom_display_name);
+ dict.GetString(kKeyVendorId, &option->vendor_id);
return true;
}
static void Save(const Media& option, base::DictionaryValue* dict) {
- if (option.type != CUSTOM_MEDIA)
- dict->SetString(kKeyName, TypeToString(kMediaDefinitions, option.type));
+ dict->SetString(kKeyName, TypeToString(kMediaDefinitions, option.type));
Vitaly Buka (NO REVIEWS) 2014/06/12 00:43:24 if (option.type != CUSTOM_MEDIA)
Aleksey Shlyapnikov 2014/06/12 00:50:05 Done.
if (!option.custom_display_name.empty() || option.type == CUSTOM_MEDIA)
dict->SetString(kCustomName, option.custom_display_name);
+ if (!option.vendor_id.empty())
+ dict->SetString(kKeyVendorId, option.vendor_id);
if (option.width_um > 0)
dict->SetInteger(kMediaWidth, option.width_um);
if (option.height_um > 0)
« no previous file with comments | « components/cloud_devices/common/printer_description.h ('k') | components/cloud_devices/common/printer_description_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698