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

Unified Diff: chrome/service/cloud_print/print_system_cups.cc

Issue 6356007: Added a diagnostic user message when enumerating printers fails. Also tweaked... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Code review changes Created 9 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 | « chrome/service/cloud_print/print_system.h ('k') | chrome/service/cloud_print/print_system_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/service/cloud_print/print_system_cups.cc
===================================================================
--- chrome/service/cloud_print/print_system_cups.cc (revision 72357)
+++ chrome/service/cloud_print/print_system_cups.cc (working copy)
@@ -28,9 +28,11 @@
#include "chrome/service/cloud_print/cloud_print_consts.h"
#include "chrome/service/cloud_print/cloud_print_helpers.h"
#include "googleurl/src/gurl.h"
+#include "grit/generated_resources.h"
#include "printing/backend/cups_helper.h"
#include "printing/backend/print_backend.h"
#include "printing/backend/print_backend_consts.h"
+#include "ui/base/l10n/l10n_util.h"
namespace {
static const char kCUPSPrinterInfoOpt[] = "printer-info";
@@ -73,7 +75,8 @@
// PrintSystem implementation.
virtual PrintSystemResult Init();
- virtual void EnumeratePrinters(printing::PrinterList* printer_list);
+ virtual PrintSystem::PrintSystemResult EnumeratePrinters(
+ printing::PrinterList* printer_list);
virtual void GetPrinterCapsAndDefaults(
const std::string& printer_name,
@@ -151,6 +154,7 @@
int update_timeout_;
bool initialized_;
+ bool printer_enum_succeeded_;
};
class PrintServerWatcherCUPS
@@ -358,7 +362,9 @@
};
PrintSystemCUPS::PrintSystemCUPS(const DictionaryValue* print_system_settings)
- : update_timeout_(kCheckForPrinterUpdatesMs), initialized_(false) {
+ : update_timeout_(kCheckForPrinterUpdatesMs),
+ initialized_(false),
+ printer_enum_succeeded_(false) {
if (print_system_settings) {
int timeout;
if (print_system_settings->GetInteger(kCUPSUpdateTimeoutMs, &timeout))
@@ -412,8 +418,10 @@
void PrintSystemCUPS::UpdatePrinters() {
PrintServerList::iterator it;
+ printer_enum_succeeded_ = true;
for (it = print_servers_.begin(); it != print_servers_.end(); ++it) {
- it->backend->EnumeratePrinters(&it->printers);
+ if (!it->backend->EnumeratePrinters(&it->printers))
+ printer_enum_succeeded_ = false;
it->caps_cache.clear();
printing::PrinterList::iterator printer_it;
for (printer_it = it->printers.begin();
@@ -431,7 +439,8 @@
GetUpdateTimeoutMs());
}
-void PrintSystemCUPS::EnumeratePrinters(printing::PrinterList* printer_list) {
+PrintSystem::PrintSystemResult PrintSystemCUPS::EnumeratePrinters(
+ printing::PrinterList* printer_list) {
DCHECK(initialized_);
printer_list->clear();
PrintServerList::iterator it;
@@ -440,6 +449,9 @@
it->printers.begin(), it->printers.end());
}
VLOG(1) << "CUPS: Total " << printer_list->size() << " printers enumerated.";
+ // TODO(sanjeevr): Maybe some day we want to report the actual server names
+ // for which the enumeration failed.
+ return PrintSystemResult(printer_enum_succeeded_, std::string());
}
void PrintSystemCUPS::GetPrinterCapsAndDefaults(
« no previous file with comments | « chrome/service/cloud_print/print_system.h ('k') | chrome/service/cloud_print/print_system_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698