diff options
author | Steve Block <steveblock@google.com> | 2010-11-29 17:18:33 +0000 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2010-12-01 21:11:00 +0000 |
commit | b84030fc8163cde1f8f055973ef63d3e1670bf52 (patch) | |
tree | c729707e5ba5ed11e581bc49c79e533ad6e96050 /WebKit/android/WebCoreSupport/WebRequestContext.h | |
parent | c7072d34375726918ff186dd3197d9677c2f98e3 (diff) | |
download | external_webkit-b84030fc8163cde1f8f055973ef63d3e1670bf52.zip external_webkit-b84030fc8163cde1f8f055973ef63d3e1670bf52.tar.gz external_webkit-b84030fc8163cde1f8f055973ef63d3e1670bf52.tar.bz2 |
Use one WebRequestContext per WebView
This change switches from using a pair of WebRequestContexts (one for
private browsing, one for regular browsing) to using one
WebRequestContext per WebView. This is required to allow us to set the
userAgent on each WebView.
The WebRequestContext is now owned by the WebView.
Bug: 3113804
Change-Id: Iba2b1490e7ce4ff65c08a04a310963fa2c7e4f83
Diffstat (limited to 'WebKit/android/WebCoreSupport/WebRequestContext.h')
-rw-r--r-- | WebKit/android/WebCoreSupport/WebRequestContext.h | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/WebKit/android/WebCoreSupport/WebRequestContext.h b/WebKit/android/WebCoreSupport/WebRequestContext.h index ec1561b..5827ce2 100644 --- a/WebKit/android/WebCoreSupport/WebRequestContext.h +++ b/WebKit/android/WebCoreSupport/WebRequestContext.h @@ -33,20 +33,18 @@ namespace android { -// This class is generally not threadsafe. .get() is not threadsafe - instances -// are created on the WebCore thread only. +// This class is generally not threadsafe. class WebRequestContext : public URLRequestContext { public: // URLRequestContext overrides. virtual const std::string& GetUserAgent(const GURL&) const; virtual const std::string& GetAcceptLanguage() const; - // Lazily create the relevant context. This class holds a reference. - static WebRequestContext* get(bool isPrivateBrowsing); + WebRequestContext(bool isPrivateBrowsing); // These methods are threadsafe. static bool cleanupPrivateBrowsingFiles(); - static void setUserAgent(WTF::String); + void setUserAgent(const WTF::String&); static void setAcceptLanguage(const WTF::String&); static const WTF::String& acceptLanguage(); @@ -59,10 +57,9 @@ private: WebRequestContext(); ~WebRequestContext(); - static WebRequestContext* getImpl(bool isPrivateBrowsing); - static WebRequestContext* getRegularContext(); - static WebRequestContext* getPrivateBrowsingContext(); - + std::string m_userAgent; + mutable WTF::Mutex m_userAgentMutex; + bool m_isPrivateBrowsing; }; } // namespace android |