AU: Only retry HTTP connect failures when updating in background.

Interactive updates (those that come from dbus, rather than a timer)
will have the check for updates retry on failed HTTP connections only
once. We will still retry on connect failures for background updates 3
times, which is important for the case where a user has just woken
from sleep.

BUG=chromium-os:16255
TEST=unittests, on device test

Change-Id: I9cb0f854856846850cfdeaa4ffbe921d76eee15b
Reviewed-on: http://gerrit.chromium.org/gerrit/2449
Tested-by: Andrew de los Reyes <adlr@chromium.org>
Reviewed-by: Darin Petkov <petkov@chromium.org>
diff --git a/update_attempter.cc b/update_attempter.cc
index a1efa95..f29b3d7 100644
--- a/update_attempter.cc
+++ b/update_attempter.cc
@@ -130,7 +130,8 @@
 
 void UpdateAttempter::Update(const std::string& app_version,
                              const std::string& omaha_url,
-                             bool obey_proxies) {
+                             bool obey_proxies,
+                             bool interactive) {
   chrome_proxy_resolver_.Init();
   fake_update_success_ = false;
   if (status_ == UPDATE_STATUS_UPDATED_NEED_REBOOT) {
@@ -175,9 +176,9 @@
   // Actions:
   LibcurlHttpFetcher* update_check_fetcher =
       new LibcurlHttpFetcher(GetProxyResolver());
-  // Try harder to connect to the network. See comment in
-  // libcurl_http_fetcher.cc.
-  update_check_fetcher->set_no_network_max_retries(3);
+  // Try harder to connect to the network, esp when not interactive.
+  // See comment in libcurl_http_fetcher.cc.
+  update_check_fetcher->set_no_network_max_retries(interactive ? 1 : 3);
   shared_ptr<OmahaRequestAction> update_check_action(
       new OmahaRequestAction(prefs_,
                              omaha_request_params_,
@@ -293,7 +294,7 @@
               << UpdateStatusToString(status_) << ", so not checking.";
     return;
   }
-  Update(app_version, omaha_url, true);
+  Update(app_version, omaha_url, true, true);
 }
 
 bool UpdateAttempter::RebootIfNeeded() {