Break reference cycle from HttpProxyClientSocket=>HttpNetworkSession=>...
Note that this undoes the fix for http://crbug.com/49387 which is now unnecessary without the cycle.
Some other miscellaneous cleanup is thrown in here.
BUG=55175
TEST=none
Review URL: http://codereview.chromium.org/3418018
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@59873 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/net/http/http_auth_controller.h b/net/http/http_auth_controller.h
index 5ee156c..097c4bc 100644
--- a/net/http/http_auth_controller.h
+++ b/net/http/http_auth_controller.h
@@ -22,7 +22,8 @@
class AuthChallengeInfo;
class HttpAuthHandler;
-class HttpNetworkSession;
+class HttpAuthHandlerFactory;
+class HttpAuthCache;
class HttpRequestHeaders;
struct HttpRequestInfo;
@@ -30,8 +31,10 @@
public:
// The arguments are self explanatory except possibly for |auth_url|, which
// should be both the auth target and auth path in a single url argument.
- HttpAuthController(HttpAuth::Target target, const GURL& auth_url,
- scoped_refptr<HttpNetworkSession> session);
+ HttpAuthController(HttpAuth::Target target,
+ const GURL& auth_url,
+ HttpAuthCache* http_auth_cache,
+ HttpAuthHandlerFactory* http_auth_handler_factory);
// Generate an authentication token for |target| if necessary. The return
// value is a net error code. |OK| will be returned both in the case that
@@ -71,11 +74,12 @@
virtual bool IsAuthSchemeDisabled(const std::string& scheme) const;
virtual void DisableAuthScheme(const std::string& scheme);
- protected: // So that we can mock this object.
+ private:
+ // So that we can mock this object.
friend class base::RefCounted<HttpAuthController>;
+
virtual ~HttpAuthController();
- private:
// Searches the auth cache for an entry that encompasses the request's path.
// If such an entry is found, updates |identity_| and |handler_| with the
// cache entry's data and returns true.
@@ -138,7 +142,11 @@
// in response to an HTTP authentication challenge.
bool default_credentials_used_;
- scoped_refptr<HttpNetworkSession> session_;
+ // These two are owned by the HttpNetworkSession/IOThread, which own the
+ // objects which reference |this|. Therefore, these raw pointers are valid
+ // for the lifetime of this object.
+ HttpAuthCache* const http_auth_cache_;
+ HttpAuthHandlerFactory* const http_auth_handler_factory_;
std::set<std::string> disabled_schemes_;