diff options
author | amit@chromium.org <amit@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-30 21:37:04 +0000 |
---|---|---|
committer | amit@chromium.org <amit@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-30 21:37:04 +0000 |
commit | a8af771d9040b87f64b3a85131cfa0e265ac5639 (patch) | |
tree | 6cd5020fcda0b6616be7fec09bd2307743763fc0 /chrome/browser/automation/automation_profile_impl.cc | |
parent | 23cc9a18ab9c4893e3cad94c3683e7ffecefcbf0 (diff) | |
download | chromium_src-a8af771d9040b87f64b3a85131cfa0e265ac5639.zip chromium_src-a8af771d9040b87f64b3a85131cfa0e265ac5639.tar.gz chromium_src-a8af771d9040b87f64b3a85131cfa0e265ac5639.tar.bz2 |
ChromeURLRequestContext fallout
Fix the issues caused by static_cast<ChromeURLRequestContext*>.
There were assumptions in the code that a URLRequestContext*
will always be ChromeURLRequestContext* and resulting
'static_cast's. This assumption is no longer true. Instead,
URLlRequestContext now has a member GetChromeURLRequestContext
that returns a ChromeURLRequestContext* if it really that type.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/160332
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22104 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/automation/automation_profile_impl.cc')
-rw-r--r-- | chrome/browser/automation/automation_profile_impl.cc | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/chrome/browser/automation/automation_profile_impl.cc b/chrome/browser/automation/automation_profile_impl.cc index 02e2cc1..1cba8d6 100644 --- a/chrome/browser/automation/automation_profile_impl.cc +++ b/chrome/browser/automation/automation_profile_impl.cc @@ -3,27 +3,37 @@ // found in the LICENSE file. #include "chrome/browser/automation/automation_profile_impl.h" +#include "chrome/browser/net/chrome_url_request_context.h" #include "chrome/test/automation/automation_messages.h" -#include "net/url_request/url_request_context.h" // A special Request context for automation. Substitute a few things // like cookie store, proxy settings etc to handle them differently // for automation. -class AutomationURLRequestContext : public URLRequestContext { +class AutomationURLRequestContext : public ChromeURLRequestContext { public: AutomationURLRequestContext(URLRequestContext* original_context, - net::CookieStore* automation_cookie_store) { - host_resolver_ = original_context->host_resolver(); - proxy_service_ = original_context->proxy_service(); - http_transaction_factory_ = original_context->http_transaction_factory(); - ftp_transaction_factory_ = original_context->ftp_transaction_factory(); + net::CookieStore* automation_cookie_store) + // All URLRequestContexts in chrome extend from ChromeURLRequestContext + : ChromeURLRequestContext(static_cast<ChromeURLRequestContext*>( + original_context)) { cookie_store_ = automation_cookie_store; - cookie_policy_.set_type(original_context->cookie_policy()->type()); - force_tls_state_ = original_context->force_tls_state(); - // ftp_auth_cache_ = original_context->ftp_auth_cache(); - accept_language_ = original_context->accept_language(); - accept_charset_ = original_context->accept_charset(); - referrer_charset_ = original_context->referrer_charset(); + } + + ~AutomationURLRequestContext() { + // Clear out members before calling base class dtor since we don't + // own any of them. + + // Clear URLRequestContext members. + host_resolver_ = NULL; + proxy_service_ = NULL; + http_transaction_factory_ = NULL; + ftp_transaction_factory_ = NULL; + cookie_store_ = NULL; + force_tls_state_ = NULL; + + // Clear ChromeURLRequestContext members. + prefs_ = NULL; + blacklist_ = NULL; } private: |