Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(534)

Unified Diff: net/url_request/url_request_context.h

Issue 19025: Add support for UA spoofing, and spoof Safari's UA string when loading URLs... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: net/url_request/url_request_context.h
===================================================================
--- net/url_request/url_request_context.h (revision 8714)
+++ net/url_request/url_request_context.h (working copy)
@@ -10,11 +10,9 @@
#ifndef NET_URL_REQUEST_URL_REQUEST_CONTEXT_H_
#define NET_URL_REQUEST_URL_REQUEST_CONTEXT_H_
-#include <string>
-
-#include "base/basictypes.h"
#include "base/ref_counted.h"
#include "base/scoped_ptr.h"
+#include "base/string_util.h"
#include "net/base/cookie_policy.h"
#include "net/ftp/ftp_auth_cache.h"
#include "net/http/http_transaction_factory.h"
@@ -53,20 +51,24 @@
// Gets the FTP authentication cache for this context.
net::FtpAuthCache* ftp_auth_cache() { return &ftp_auth_cache_; }
- // Gets the UA string to use for this context.
- const std::string& user_agent() const { return user_agent_; }
-
// Gets the value of 'Accept-Charset' header field.
const std::string& accept_charset() const { return accept_charset_; }
// Gets the value of 'Accept-Language' header field.
const std::string& accept_language() const { return accept_language_; }
- // Do not call this directly. TODO(darin): extending from RefCounted* should
- // not require a public destructor!
+ // Gets the UA string to use for the given URL. If the given URL is not a
+ // valid URL, then the default UA string should be returned. Subclasses
wtc 2009/01/27 19:19:24 It's not clear what you meant by the "default UA s
darin (slow to review) 2009/01/27 19:52:06 Nice suggestion, thanks.
+ // should override this method to provide a UA string.
+ virtual const std::string& GetUserAgent(const GURL& url) const {
+ return EmptyString();
+ }
+
+ protected:
+ friend class base::RefCountedThreadSafe<URLRequestContext>;
+
virtual ~URLRequestContext() {}
wtc 2009/01/27 19:19:24 Just curious: can we make the destructor private?
darin (slow to review) 2009/01/27 19:52:06 yes!
darin (slow to review) 2009/01/27 20:00:11 actually, nevermind. a private destructor prevent
- protected:
// The following members are expected to be initialized and owned by
// subclasses.
net::ProxyService* proxy_service_;
@@ -74,13 +76,11 @@
net::CookieMonster* cookie_store_;
net::CookiePolicy cookie_policy_;
net::FtpAuthCache ftp_auth_cache_;
- std::string user_agent_;
std::string accept_language_;
std::string accept_charset_;
private:
- DISALLOW_EVIL_CONSTRUCTORS(URLRequestContext);
+ DISALLOW_COPY_AND_ASSIGN(URLRequestContext);
};
#endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_H_
-

Powered by Google App Engine
This is Rietveld 408576698