[Refactor] Rename DnsResolutionObserver --> HostResolver::Observer.

TEST=this is striclty a refactoring; just needs to compile and pass existing tests.

BUG=14056

Review URL: http://codereview.chromium.org/126110

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@18372 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/net/dns_global.cc b/chrome/browser/net/dns_global.cc
index 1d808cb..a3d1eb8 100644
--- a/chrome/browser/net/dns_global.cc
+++ b/chrome/browser/net/dns_global.cc
@@ -22,7 +22,6 @@
 #include "chrome/common/notification_service.h"
 #include "chrome/common/pref_names.h"
 #include "chrome/common/pref_service.h"
-#include "net/base/dns_resolution_observer.h"
 #include "net/base/host_resolver.h"
 
 using base::TimeDelta;
@@ -138,7 +137,7 @@
 // There will only be one instance ever created of the following Observer
 // class.  As a result, we get away with using static members for data local
 // to that instance (to better comply with a google style guide exemption).
-class PrefetchObserver : public net::DnsResolutionObserver {
+class PrefetchObserver : public net::HostResolver::Observer {
  public:
   PrefetchObserver();
   ~PrefetchObserver();
diff --git a/net/base/dns_resolution_observer.h b/net/base/dns_resolution_observer.h
deleted file mode 100644
index 1651308..0000000
--- a/net/base/dns_resolution_observer.h
+++ /dev/null
@@ -1,45 +0,0 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// This file supports network stack independent notification of progress
-// towards resolving a hostname.
-
-// The observer class supports exactly one active (Add'ed) instance, and in
-// typical usage, that observer will be Add'ed during process startup, and
-// Remove'd during process termination.
-
-
-#ifndef NET_BASE_DNS_RESOLUTION_OBSERVER_H_
-#define NET_BASE_DNS_RESOLUTION_OBSERVER_H_
-
-#include <string>
-
-#include "net/base/host_resolver.h"
-
-class GURL;
-
-namespace net {
-
-// TODO(eroman): Move this interface to HostResolver::Observer.
-class DnsResolutionObserver {
- public:
-  virtual ~DnsResolutionObserver() {}
-
-  // For each OnStartResolution() notification, there should be a later
-  // OnFinishResolutionWithStatus() indicating completion of the resolution
-  // activity.
-  // Related pairs of notification will arrive with matching id values.
-  // A caller may use the id values to match up these asynchronous calls
-  // from among a larger call stream.
-  virtual void OnStartResolution(int id,
-                                 const HostResolver::RequestInfo& info) = 0;
-  virtual void OnFinishResolutionWithStatus(
-      int id,
-      bool was_resolved,
-      const HostResolver::RequestInfo& info) = 0;
-};
-
-}  // namspace net
-
-#endif  // NET_BASE_DNS_RESOLUTION_OBSERVER_H_
diff --git a/net/base/host_resolver.cc b/net/base/host_resolver.cc
index 6dcef85..5a357eb0 100644
--- a/net/base/host_resolver.cc
+++ b/net/base/host_resolver.cc
@@ -22,7 +22,6 @@
 #include "base/time.h"
 #include "base/worker_pool.h"
 #include "net/base/address_list.h"
-#include "net/base/dns_resolution_observer.h"
 #include "net/base/net_errors.h"
 
 #if defined(OS_LINUX)
@@ -482,11 +481,11 @@
   req->Cancel();
 }
 
-void HostResolver::AddObserver(DnsResolutionObserver* observer) {
+void HostResolver::AddObserver(Observer* observer) {
   observers_.push_back(observer);
 }
 
-void HostResolver::RemoveObserver(DnsResolutionObserver* observer) {
+void HostResolver::RemoveObserver(Observer* observer) {
   ObserversList::iterator it =
       std::find(observers_.begin(), observers_.end(), observer);
 
diff --git a/net/base/host_resolver.h b/net/base/host_resolver.h
index 9a7b7b9..34c803fd 100644
--- a/net/base/host_resolver.h
+++ b/net/base/host_resolver.h
@@ -20,7 +20,6 @@
 namespace net {
 
 class AddressList;
-class DnsResolutionObserver;
 class HostMapper;
 
 // This class represents the task of resolving hostnames (or IP address
@@ -100,6 +99,22 @@
     GURL referrer_;
   };
 
+  // Interface for observing the requests that flow through a HostResolver.
+  class Observer {
+   public:
+    virtual ~Observer() {}
+
+    // Called at the start of HostResolver::Resolve(). |id| is a unique number
+    // given to the request, so it can be matched up with a corresponding call
+    // to OnFinishResolutionWithStatus().
+    virtual void OnStartResolution(int id, const RequestInfo& info) = 0;
+
+    // Called on completion of request |id|. Note that if the request was
+    // cancelled, OnFinishResolutionWithStatus() will not be called.
+    virtual void OnFinishResolutionWithStatus(int id, bool was_resolved,
+                                              const RequestInfo& info) = 0;
+  };
+
   // Creates a HostResolver that caches up to |max_cache_entries| for
   // |cache_duration_ms| milliseconds.
   //
@@ -137,16 +152,16 @@
   // Adds an observer to this resolver. The observer will be notified of the
   // start and completion of all requests (excluding cancellation). |observer|
   // must remain valid for the duration of this HostResolver's lifetime.
-  void AddObserver(DnsResolutionObserver* observer);
+  void AddObserver(Observer* observer);
 
   // Unregisters an observer previously added by AddObserver().
-  void RemoveObserver(DnsResolutionObserver* observer);
+  void RemoveObserver(Observer* observer);
 
  private:
   class Job;
   typedef std::vector<Request*> RequestsList;
   typedef base::hash_map<std::string, scoped_refptr<Job> > JobMap;
-  typedef std::vector<DnsResolutionObserver*> ObserversList;
+  typedef std::vector<Observer*> ObserversList;
 
   // Adds a job to outstanding jobs list.
   void AddOutstandingJob(Job* job);
diff --git a/net/base/host_resolver_unittest.cc b/net/base/host_resolver_unittest.cc
index 393385af..9c07c29 100644
--- a/net/base/host_resolver_unittest.cc
+++ b/net/base/host_resolver_unittest.cc
@@ -18,7 +18,6 @@
 #include "base/ref_counted.h"
 #include "net/base/address_list.h"
 #include "net/base/completion_callback.h"
-#include "net/base/dns_resolution_observer.h"
 #include "net/base/host_resolver_unittest.h"
 #include "net/base/net_errors.h"
 #include "testing/gtest/include/gtest/gtest.h"
@@ -697,7 +696,7 @@
 
 // Observer that just makes note of how it was called. The test code can then
 // inspect to make sure it was called with the right parameters.
-class CapturingObserver : public net::DnsResolutionObserver {
+class CapturingObserver : public net::HostResolver::Observer {
  public:
   // DnsResolutionObserver methods:
   virtual void OnStartResolution(int id,
diff --git a/net/base/tcp_client_socket_pool.cc b/net/base/tcp_client_socket_pool.cc
index c5e961e4..7dadd4c 100644
--- a/net/base/tcp_client_socket_pool.cc
+++ b/net/base/tcp_client_socket_pool.cc
@@ -11,7 +11,6 @@
 #include "base/stl_util-inl.h"
 #include "net/base/client_socket_factory.h"
 #include "net/base/client_socket_handle.h"
-#include "net/base/dns_resolution_observer.h"
 #include "net/base/net_errors.h"
 #include "net/base/tcp_client_socket.h"
 
diff --git a/net/ftp/ftp_network_transaction.cc b/net/ftp/ftp_network_transaction.cc
index 18bd808..6c71582 100644
--- a/net/ftp/ftp_network_transaction.cc
+++ b/net/ftp/ftp_network_transaction.cc
@@ -9,7 +9,6 @@
 #include "net/base/client_socket.h"
 #include "net/base/client_socket_factory.h"
 #include "net/base/connection_type_histograms.h"
-#include "net/base/dns_resolution_observer.h"
 #include "net/base/net_errors.h"
 #include "net/ftp/ftp_network_session.h"
 #include "net/ftp/ftp_request_info.h"
diff --git a/net/http/http_network_transaction.cc b/net/http/http_network_transaction.cc
index d5cd81f..f4a7879 100644
--- a/net/http/http_network_transaction.cc
+++ b/net/http/http_network_transaction.cc
@@ -12,7 +12,6 @@
 #include "build/build_config.h"
 #include "net/base/client_socket_factory.h"
 #include "net/base/connection_type_histograms.h"
-#include "net/base/dns_resolution_observer.h"
 #include "net/base/io_buffer.h"
 #include "net/base/load_flags.h"
 #include "net/base/net_errors.h"
diff --git a/net/net.gyp b/net/net.gyp
index d187781..536f1de 100644
--- a/net/net.gyp
+++ b/net/net.gyp
@@ -61,7 +61,6 @@
         'base/data_url.h',
         'base/directory_lister.cc',
         'base/directory_lister.h',
-        'base/dns_resolution_observer.h',
         'base/effective_tld_names.cc',
         'base/effective_tld_names.dat',
         'base/escape.cc',