Chromium Code Reviews| Index: chrome/browser/safe_browsing/safe_browsing_service.cc |
| diff --git a/chrome/browser/safe_browsing/safe_browsing_service.cc b/chrome/browser/safe_browsing/safe_browsing_service.cc |
| index a85f688967be6e3d59626039820eac635c603c1b..a4a21916f75d63411a9c99b83a5e84a95af9f3e5 100644 |
| --- a/chrome/browser/safe_browsing/safe_browsing_service.cc |
| +++ b/chrome/browser/safe_browsing/safe_browsing_service.cc |
| @@ -18,6 +18,7 @@ |
| #include "chrome/browser/api/prefs/pref_change_registrar.h" |
| #include "chrome/browser/browser_process.h" |
| #include "chrome/browser/metrics/metrics_service.h" |
| +#include "chrome/browser/net/basic_http_user_agent_settings.h" |
| #include "chrome/browser/net/sqlite_persistent_cookie_store.h" |
| #include "chrome/browser/prefs/pref_service.h" |
| #include "chrome/browser/profiles/profile.h" |
| @@ -100,22 +101,6 @@ FilePath CookieFilePath() { |
| } // namespace |
| -// Custom URLRequestContext used by SafeBrowsing requests, which are not |
| -// associated with a particular profile. We need to use a subclass of |
| -// URLRequestContext in order to provide the correct User-Agent. |
| -class SafeBrowsingURLRequestContext : public net::URLRequestContext { |
| - public: |
| - virtual const std::string& GetUserAgent( |
| - const GURL& url) const OVERRIDE { |
| - return content::GetUserAgent(url); |
| - } |
| - |
| - private: |
| - virtual ~SafeBrowsingURLRequestContext() {} |
| - |
| - base::debug::LeakTracker<SafeBrowsingURLRequestContext> leak_tracker_; |
| -}; |
| - |
| class SafeBrowsingURLRequestContextGetter |
| : public net::URLRequestContextGetter { |
| public: |
| @@ -622,7 +607,11 @@ void SafeBrowsingService::InitURLRequestContextOnIOThread( |
| new SQLitePersistentCookieStore(CookieFilePath(), false, NULL), |
| NULL); |
| - url_request_context_.reset(new SafeBrowsingURLRequestContext); |
| + url_request_context_.reset(new net::URLRequestContext); |
| + http_user_agent_settings_.reset( |
| + new BasicHttpUserAgentSettings(EmptyString(), EmptyString())); |
| + url_request_context_->set_http_user_agent_settings( |
| + http_user_agent_settings_.get()); |
| // |system_url_request_context_getter| may be NULL during tests. |
| if (system_url_request_context_getter) |
| url_request_context_->CopyFrom( |
|
erikwright (departed)
2012/09/25 21:06:38
Is this copying the HttpUserAgentSettings from the
pauljensen
2012/09/26 14:08:19
I was inserting a BasicHttpUserAgentSettings to pr
erikwright (departed)
2012/09/26 14:19:36
I see. Good catch, actually.
|