Index: chrome/service/cloud_print/print_system_cups.cc |
diff --git a/chrome/service/cloud_print/print_system_cups.cc b/chrome/service/cloud_print/print_system_cups.cc |
index e77377182d7216be13312861ea57d1c3065d4587..f28b91b6ee1354a39eb37b3519cb749b72f00af0 100644 |
--- a/chrome/service/cloud_print/print_system_cups.cc |
+++ b/chrome/service/cloud_print/print_system_cups.cc |
@@ -49,10 +49,10 @@ const char kCUPSNotifyDelete[] = "notify_delete"; |
const int kDefaultIPPServerPort = 631; |
// Time interval to check for printer's updates. |
-const int kCheckForPrinterUpdatesMs = 5*60*1000; |
+const int kCheckForPrinterUpdatesMinutes = 5; |
// Job update timeout |
-const int kJobUpdateTimeoutMs = 5000; |
+const int kJobUpdateTimeoutSeconds = 5; |
// Job id for dry run (it should not affect CUPS job ids, since 0 job-id is |
// invalid in CUPS. |
@@ -115,7 +115,7 @@ class PrintSystemCUPS : public PrintSystem { |
const std::string& printer_name, |
printing::PrinterCapsAndDefaults* printer_info); |
- int GetUpdateTimeoutMs() const { |
+ base::TimeDelta GetUpdateTimeout() const { |
return update_timeout_; |
} |
@@ -159,7 +159,7 @@ class PrintSystemCUPS : public PrintSystem { |
typedef std::list<PrintServerInfoCUPS> PrintServerList; |
PrintServerList print_servers_; |
- int update_timeout_; |
+ base::TimeDelta update_timeout_; |
bool initialized_; |
bool printer_enum_succeeded_; |
bool notify_delete_; |
@@ -184,7 +184,7 @@ class PrintServerWatcherCUPS |
MessageLoop::current()->PostDelayedTask( |
FROM_HERE, |
base::Bind(&PrintServerWatcherCUPS::CheckForUpdates, this), |
- print_system_->GetUpdateTimeoutMs()); |
+ print_system_->GetUpdateTimeout()); |
return true; |
} |
@@ -205,7 +205,7 @@ class PrintServerWatcherCUPS |
MessageLoop::current()->PostDelayedTask( |
FROM_HERE, |
base::Bind(&PrintServerWatcherCUPS::CheckForUpdates, this), |
- print_system_->GetUpdateTimeoutMs()); |
+ print_system_->GetUpdateTimeout()); |
} |
private: |
@@ -259,13 +259,13 @@ class PrinterWatcherCUPS |
MessageLoop::current()->PostDelayedTask( |
FROM_HERE, |
base::Bind(&PrinterWatcherCUPS::JobStatusUpdate, this), |
- kJobUpdateTimeoutMs); |
+ base::TimeDelta::FromSeconds(kJobUpdateTimeoutSeconds)); |
// Schedule next printer check. |
// TODO(gene): Randomize time for the next printer update. |
MessageLoop::current()->PostDelayedTask( |
FROM_HERE, |
base::Bind(&PrinterWatcherCUPS::PrinterUpdate, this), |
- print_system_->GetUpdateTimeoutMs()); |
+ print_system_->GetUpdateTimeout()); |
return true; |
} |
@@ -290,7 +290,7 @@ class PrinterWatcherCUPS |
MessageLoop::current()->PostDelayedTask( |
FROM_HERE, |
base::Bind(&PrinterWatcherCUPS::JobStatusUpdate, this), |
- kJobUpdateTimeoutMs); |
+ base::TimeDelta::FromSeconds(kJobUpdateTimeoutSeconds)); |
} |
void PrinterUpdate() { |
@@ -312,7 +312,7 @@ class PrinterWatcherCUPS |
MessageLoop::current()->PostDelayedTask( |
FROM_HERE, |
base::Bind(&PrinterWatcherCUPS::PrinterUpdate, this), |
- print_system_->GetUpdateTimeoutMs()); |
+ print_system_->GetUpdateTimeout()); |
} |
private: |
@@ -390,14 +390,15 @@ class JobSpoolerCUPS : public PrintSystem::JobSpooler { |
}; |
PrintSystemCUPS::PrintSystemCUPS(const DictionaryValue* print_system_settings) |
- : update_timeout_(kCheckForPrinterUpdatesMs), |
+ : update_timeout_(base::TimeDelta::FromMinutes( |
+ kCheckForPrinterUpdatesMinutes)), |
initialized_(false), |
printer_enum_succeeded_(false), |
notify_delete_(true) { |
if (print_system_settings) { |
int timeout; |
if (print_system_settings->GetInteger(kCUPSUpdateTimeoutMs, &timeout)) |
- update_timeout_ = timeout; |
+ update_timeout_ = base::TimeDelta::FromMilliseconds(timeout); |
bool notify_delete = true; |
if (print_system_settings->GetBoolean(kCUPSNotifyDelete, ¬ify_delete)) |
@@ -469,7 +470,7 @@ void PrintSystemCUPS::UpdatePrinters() { |
// Schedule next update. |
MessageLoop::current()->PostDelayedTask( |
FROM_HERE, |
- base::Bind(&PrintSystemCUPS::UpdatePrinters, this), GetUpdateTimeoutMs()); |
+ base::Bind(&PrintSystemCUPS::UpdatePrinters, this), GetUpdateTimeout()); |
} |
PrintSystem::PrintSystemResult PrintSystemCUPS::EnumeratePrinters( |