ApplicationManager: Use callback to get notified on application shutdown.

Until now, the Delegate had a OnApplicationError that was called
whenever an application ended. Because it was used to keep track of when
a given started application ended, it needed to send back the URL that
was used to start an application. This was cumbersome as mapping and
rediect change the url during the loading process.

Instead this change allows a caller fo ApplicationManager to register a
closure that will be called when the application ends, if the call
started a new application.

R=davemoore@chromium.org

Review URL: https://codereview.chromium.org/983113002
diff --git a/shell/application_manager/shell_impl.cc b/shell/application_manager/shell_impl.cc
index d519cba..76c54da 100644
--- a/shell/application_manager/shell_impl.cc
+++ b/shell/application_manager/shell_impl.cc
@@ -13,11 +13,11 @@
 
 ShellImpl::ShellImpl(ApplicationPtr application,
                      ApplicationManager* manager,
-                     const GURL& requested_url,
-                     const Identity& identity)
+                     const Identity& identity,
+                     const base::Closure& on_application_end)
     : manager_(manager),
-      requested_url_(requested_url),
       identity_(identity),
+      on_application_end_(on_application_end),
       application_(application.Pass()),
       binding_(this) {
   binding_.set_error_handler(this);
@@ -50,7 +50,7 @@
     return;
   }
   manager_->ConnectToApplication(app_gurl, identity_.url, services.Pass(),
-                                 exposed_services.Pass());
+                                 exposed_services.Pass(), base::Closure());
 }
 
 void ShellImpl::OnConnectionError() {