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

Unified Diff: chrome/browser/chromeos/printing/specifics_translation.cc

Issue 2884863002: Add an autoconf field to printer objects. (Closed)
Patch Set: grammar Created 3 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/printing/specifics_translation.cc
diff --git a/chrome/browser/chromeos/printing/specifics_translation.cc b/chrome/browser/chromeos/printing/specifics_translation.cc
index 6f5cbae08387434ebea3d3826f6d666bcf82a73a..4719092f42219221ea3a5c14088d49f8ac1bcb41 100644
--- a/chrome/browser/chromeos/printing/specifics_translation.cc
+++ b/chrome/browser/chromeos/printing/specifics_translation.cc
@@ -21,24 +21,30 @@ namespace {
Printer::PpdReference SpecificsToPpd(
const sync_pb::PrinterPPDReference& specifics) {
Printer::PpdReference ref;
- if (specifics.has_user_supplied_ppd_url()) {
+ if (specifics.autoconf()) {
+ ref.autoconf = specifics.autoconf();
+ } else if (specifics.has_user_supplied_ppd_url()) {
ref.user_supplied_ppd_url = specifics.user_supplied_ppd_url();
- }
-
- if (specifics.has_effective_make_and_model()) {
+ } else if (specifics.has_effective_make_and_model()) {
ref.effective_make_and_model = specifics.effective_make_and_model();
}
return ref;
}
+// Overwrite fields in |specifics| with an appropriately filled field from
+// |ref|. If |ref| is the default object, nothing will be changed in
+// |specifics|.
void MergeReferenceToSpecifics(sync_pb::PrinterPPDReference* specifics,
const Printer::PpdReference& ref) {
- if (!ref.user_supplied_ppd_url.empty()) {
+ if (ref.autoconf) {
+ specifics->Clear();
+ specifics->set_autoconf(ref.autoconf);
+ } else if (!ref.user_supplied_ppd_url.empty()) {
+ specifics->Clear();
specifics->set_user_supplied_ppd_url(ref.user_supplied_ppd_url);
- }
-
- if (!ref.effective_make_and_model.empty()) {
+ } else if (!ref.effective_make_and_model.empty()) {
+ specifics->Clear();
specifics->set_effective_make_and_model(ref.effective_make_and_model);
}
}

Powered by Google App Engine
This is Rietveld 408576698