diff options
author | earthdok@chromium.org <earthdok@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-27 14:39:08 +0000 |
---|---|---|
committer | earthdok@chromium.org <earthdok@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-27 14:39:08 +0000 |
commit | 33ad6ce948e24e01ec1634af63001dda4ac0506a (patch) | |
tree | 71daec231014a7b05e1a213e2ac0a9a41f4ca52a /android_webview/browser | |
parent | d0a60eea5c90a5b594604c91654859a493e1b5cb (diff) | |
download | chromium_src-33ad6ce948e24e01ec1634af63001dda4ac0506a.zip chromium_src-33ad6ce948e24e01ec1634af63001dda4ac0506a.tar.gz chromium_src-33ad6ce948e24e01ec1634af63001dda4ac0506a.tar.bz2 |
Revert 219709 "Remove the Extensions URLRequestContext."
Reverted due to crashes under memory tools.
BUG=280138
> Remove the Extensions URLRequestContext.
>
> Though chrome-extension: scheme URLs support cookies, they do not share
> a namespace with http: and https:. In particular, chrome-extension://a and
> http://a should not have the same set of cookies.
>
> To enforce this, previously the code created a completely separate
> URLRequestContext for servicing chrome-extension: schemes. However,
> the code really only used this object as a method for conveying the
> correct cookie jar from Profile creation to a few spots where cookies
> were accessed; the rest of the URLRequestContext functionality was unused.
>
> This CL removes the Extensions URLRequestContext code and replaces it
> with APIs that directly expose the needed net::CookieStore.
>
> Lastly, CookieMonster::EnableFileScheme() is removed and
> CookieMonster::Delegate is renamed CookieMonsterDelegate.
>
> EnableFileScheme is an inherently racy API because
> CookieMonsters are creatable on all threads and this
> function sets an unprotected global flag. CookieMonsterDelegate
> is preferable to the nested interface because it can now be
> forward declared.
>
> TBRing darin and sky to cover the rest of the mechanical unittest changes.
>
> TBR=darin,sky
> BUG=158386,159193,57884
>
> Review URL: https://chromiumcodereview.appspot.com/12546016
TBR=ajwong@chromium.org
Review URL: https://codereview.chromium.org/23551005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@219787 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'android_webview/browser')
4 files changed, 16 insertions, 31 deletions
diff --git a/android_webview/browser/aw_browser_context.cc b/android_webview/browser/aw_browser_context.cc index 20b73913..9700645 100644 --- a/android_webview/browser/aw_browser_context.cc +++ b/android_webview/browser/aw_browser_context.cc @@ -21,9 +21,6 @@ #include "content/public/browser/resource_context.h" #include "content/public/browser/storage_partition.h" #include "content/public/browser/web_contents.h" -#include "content/public/common/content_constants.h" -#include "content/public/common/url_constants.h" -#include "net/cookies/cookie_monster.h" #include "net/url_request/url_request_context.h" namespace android_webview { @@ -98,11 +95,16 @@ AwBrowserContext* AwBrowserContext::FromWebContents( } void AwBrowserContext::PreMainMessageLoopRun() { - url_request_context_getter_ = new AwURLRequestContextGetter(GetPath()); + cookie_store_ = content::CreatePersistentCookieStore( + GetPath().Append(FILE_PATH_LITERAL("Cookies")), + true, + NULL, + NULL); + cookie_store_->GetCookieMonster()->SetPersistSessionCookies(true); + url_request_context_getter_ = + new AwURLRequestContextGetter(GetPath(), cookie_store_.get()); - DidCreateCookieMonster( - GetDefaultStoragePartition(this)->GetCookieStoreForScheme( - chrome::kHttpScheme)->GetCookieMonster()); + DidCreateCookieMonster(cookie_store_->GetCookieMonster()); visitedlink_master_.reset( new visitedlink::VisitedLinkMaster(this, this, false)); @@ -180,22 +182,6 @@ base::FilePath AwBrowserContext::GetPath() const { return context_storage_path_; } -void AwBrowserContext::OverrideCookieStoreConfigs( - const base::FilePath& partition_path, - bool in_memory_partition, - bool is_default_partition, - CookieSchemeMap* configs) { - using content::CookieStoreConfig; - configs->clear(); - // By default session cookies are always restored. An Android application can - // control this policy by calling CookieManager.removeSessionCookie() when - // Activity.onCreate() is called with savedInstanceState == null. - (*configs)[content::BrowserContext::kDefaultCookieScheme] = - CookieStoreConfig(partition_path.Append(content::kCookieFilename), - CookieStoreConfig::RESTORED_SESSION_COOKIES, - NULL, NULL); -} - bool AwBrowserContext::IsOffTheRecord() const { // Android WebView does not support off the record profile yet. return false; diff --git a/android_webview/browser/aw_browser_context.h b/android_webview/browser/aw_browser_context.h index bca66d7..1654d9a 100644 --- a/android_webview/browser/aw_browser_context.h +++ b/android_webview/browser/aw_browser_context.h @@ -77,11 +77,6 @@ class AwBrowserContext : public content::BrowserContext, // content::BrowserContext implementation. virtual base::FilePath GetPath() const OVERRIDE; - virtual void OverrideCookieStoreConfigs( - const base::FilePath& partition_path, - bool in_memory_partition, - bool is_default_partition, - CookieSchemeMap* configs) OVERRIDE; virtual bool IsOffTheRecord() const OVERRIDE; virtual net::URLRequestContextGetter* GetRequestContext() OVERRIDE; virtual net::URLRequestContextGetter* GetRequestContextForRenderProcess( diff --git a/android_webview/browser/net/aw_url_request_context_getter.cc b/android_webview/browser/net/aw_url_request_context_getter.cc index 069d194..4a5ea41 100644 --- a/android_webview/browser/net/aw_url_request_context_getter.cc +++ b/android_webview/browser/net/aw_url_request_context_getter.cc @@ -16,8 +16,8 @@ #include "base/threading/sequenced_worker_pool.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/content_browser_client.h" +#include "content/public/browser/cookie_store_factory.h" #include "content/public/common/content_client.h" -#include "content/public/common/content_constants.h" #include "content/public/common/url_constants.h" #include "net/base/cache_type.h" #include "net/cookies/cookie_store.h" @@ -121,8 +121,9 @@ scoped_ptr<net::URLRequestJobFactory> CreateJobFactory( } // namespace AwURLRequestContextGetter::AwURLRequestContextGetter( - const base::FilePath& partition_path) + const base::FilePath& partition_path, net::CookieStore* cookie_store) : partition_path_(partition_path), + cookie_store_(cookie_store), proxy_config_service_(net::ProxyService::CreateSystemProxyConfigService( GetNetworkTaskRunner(), NULL /* Ignored on Android */)) { @@ -168,6 +169,7 @@ void AwURLRequestContextGetter::InitializeURLRequestContext() { BrowserThread::GetMessageLoopProxyForThread(BrowserThread::CACHE))); main_http_factory_.reset(main_cache); url_request_context_->set_http_transaction_factory(main_cache); + url_request_context_->set_cookie_store(cookie_store_); job_factory_ = CreateJobFactory(&protocol_handlers_); url_request_context_->set_job_factory(job_factory_.get()); diff --git a/android_webview/browser/net/aw_url_request_context_getter.h b/android_webview/browser/net/aw_url_request_context_getter.h index 40a8395..c16098e 100644 --- a/android_webview/browser/net/aw_url_request_context_getter.h +++ b/android_webview/browser/net/aw_url_request_context_getter.h @@ -28,7 +28,8 @@ class AwNetworkDelegate; class AwURLRequestContextGetter : public net::URLRequestContextGetter { public: - AwURLRequestContextGetter(const base::FilePath& partition_path); + AwURLRequestContextGetter(const base::FilePath& partition_path, + net::CookieStore* cookie_store); void InitializeOnNetworkThread(); @@ -52,6 +53,7 @@ class AwURLRequestContextGetter : public net::URLRequestContextGetter { void InitializeURLRequestContext(); const base::FilePath partition_path_; + scoped_refptr<net::CookieStore> cookie_store_; scoped_ptr<net::URLRequestContext> url_request_context_; scoped_ptr<net::ProxyConfigService> proxy_config_service_; scoped_ptr<net::URLRequestJobFactory> job_factory_; |