Documents what ApplicationManager::Delegate do

And renames one to better indicate what it is expected to do.

This is a port of https://codereview.chromium.org/1052103005/.

R=davemoore@chromium.org

Review URL: https://codereview.chromium.org/1105063002
diff --git a/shell/application_manager/application_manager.cc b/shell/application_manager/application_manager.cc
index 85a6f32..4973827 100644
--- a/shell/application_manager/application_manager.cc
+++ b/shell/application_manager/application_manager.cc
@@ -47,17 +47,6 @@
 
 }  // namespace
 
-ApplicationManager::Delegate::~Delegate() {
-}
-
-GURL ApplicationManager::Delegate::ResolveURL(const GURL& url) {
-  return url;
-}
-
-GURL ApplicationManager::Delegate::ResolveMappings(const GURL& url) {
-  return url;
-}
-
 class ApplicationManager::ContentHandlerConnection : public mojo::ErrorHandler {
  public:
   ContentHandlerConnection(ApplicationManager* manager,
@@ -153,7 +142,7 @@
     return;
   }
 
-  GURL resolved_url = delegate_->ResolveURL(mapped_url);
+  GURL resolved_url = delegate_->ResolveMojoURL(mapped_url);
   if (ConnectToRunningApplication(resolved_url, requestor_url, &services,
                                   &exposed_services)) {
     return;
@@ -433,7 +422,7 @@
     url_to_args_[mapped_url].insert(url_to_args_[mapped_url].end(),
                                     args.begin(), args.end());
   }
-  GURL resolved_url = delegate_->ResolveURL(mapped_url);
+  GURL resolved_url = delegate_->ResolveMojoURL(mapped_url);
   if (resolved_url != mapped_url) {
     url_to_args_[resolved_url].insert(url_to_args_[resolved_url].end(),
                                       args.begin(), args.end());
@@ -445,7 +434,8 @@
     const GURL& url) {
   DCHECK(!url.has_query());  // Precondition.
   // Apply mappings and resolution to get the resolved URL.
-  GURL resolved_url = delegate_->ResolveURL(delegate_->ResolveMappings(url));
+  GURL resolved_url =
+      delegate_->ResolveMojoURL(delegate_->ResolveMappings(url));
   DCHECK(!resolved_url.has_query());  // Still shouldn't have query.
   // TODO(vtl): We should probably also remove/disregard the query string (and
   // maybe canonicalize in other ways).
diff --git a/shell/application_manager/application_manager.h b/shell/application_manager/application_manager.h
index 5d1e1c9..52b9050 100644
--- a/shell/application_manager/application_manager.h
+++ b/shell/application_manager/application_manager.h
@@ -35,9 +35,16 @@
  public:
   class Delegate {
    public:
-    virtual ~Delegate();
-    virtual GURL ResolveURL(const GURL& url);
-    virtual GURL ResolveMappings(const GURL& url);
+    // Gives the delegate a chance to apply any mappings for the specified url.
+    // This should not resolve 'mojo' urls, that is done by ResolveMojoURL().
+    virtual GURL ResolveMappings(const GURL& url) = 0;
+
+    // Used to map a url with the scheme 'mojo' to the appropriate url. Return
+    // |url| if the scheme is not 'mojo'.
+    virtual GURL ResolveMojoURL(const GURL& url) = 0;
+
+   protected:
+    virtual ~Delegate() {}
   };
 
   // API for testing.
diff --git a/shell/application_manager/application_manager_unittest.cc b/shell/application_manager/application_manager_unittest.cc
index 25c373a..9b14fcb 100644
--- a/shell/application_manager/application_manager_unittest.cc
+++ b/shell/application_manager/application_manager_unittest.cc
@@ -410,9 +410,7 @@
       return it->second;
     return url;
   }
-
-  // ApplicationManager::Delegate
-  GURL ResolveURL(const GURL& url) override {
+  GURL ResolveMojoURL(const GURL& url) override {
     GURL mapped_url = ResolveMappings(url);
     // The shell automatically map mojo URLs.
     if (mapped_url.scheme() == "mojo") {
diff --git a/shell/context.cc b/shell/context.cc
index 52b77ac..f97d0a5 100644
--- a/shell/context.cc
+++ b/shell/context.cc
@@ -304,14 +304,14 @@
   base::MessageLoop::current()->Run();
 }
 
-GURL Context::ResolveURL(const GURL& url) {
-  return url_resolver_.ResolveMojoURL(url);
-}
-
 GURL Context::ResolveMappings(const GURL& url) {
   return url_resolver_.ApplyMappings(url);
 }
 
+GURL Context::ResolveMojoURL(const GURL& url) {
+  return url_resolver_.ResolveMojoURL(url);
+}
+
 void Context::OnShutdownComplete() {
   DCHECK_EQ(base::MessageLoop::current()->task_runner(),
             task_runners_->shell_runner());
diff --git a/shell/context.h b/shell/context.h
index 73ad3a4..d28ed69 100644
--- a/shell/context.h
+++ b/shell/context.h
@@ -71,8 +71,8 @@
   class NativeViewportApplicationLoader;
 
   // ApplicationManager::Delegate overrides.
-  GURL ResolveURL(const GURL& url) override;
   GURL ResolveMappings(const GURL& url) override;
+  GURL ResolveMojoURL(const GURL& url) override;
 
   // ProcessDelegate implementation.
   void OnShutdownComplete() override;
diff --git a/shell/native_runner_unittest.cc b/shell/native_runner_unittest.cc
index 05c07c3..2b732c0 100644
--- a/shell/native_runner_unittest.cc
+++ b/shell/native_runner_unittest.cc
@@ -77,9 +77,8 @@
 
  private:
   // ApplicationManager::Delegate
-  GURL ResolveURL(const GURL& url) override { return url; }
-
   GURL ResolveMappings(const GURL& url) override { return url; }
+  GURL ResolveMojoURL(const GURL& url) override { return url; }
 };
 
 TEST_F(NativeApplicationLoaderTest, DoesNotExist) {