Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "android_webview/browser/net/aw_url_request_context_getter.h" | 5 #include "android_webview/browser/net/aw_url_request_context_getter.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "android_webview/browser/aw_browser_context.h" | 9 #include "android_webview/browser/aw_browser_context.h" |
| 10 #include "android_webview/browser/aw_content_browser_client.h" | 10 #include "android_webview/browser/aw_content_browser_client.h" |
| 11 #include "android_webview/browser/aw_request_interceptor.h" | 11 #include "android_webview/browser/aw_request_interceptor.h" |
| 12 #include "android_webview/browser/net/aw_network_delegate.h" | 12 #include "android_webview/browser/net/aw_network_delegate.h" |
| 13 #include "android_webview/browser/net/aw_url_request_job_factory.h" | 13 #include "android_webview/browser/net/aw_url_request_job_factory.h" |
| 14 #include "android_webview/browser/net/init_native_callback.h" | 14 #include "android_webview/browser/net/init_native_callback.h" |
| 15 #include "android_webview/common/aw_switches.h" | 15 #include "android_webview/common/aw_switches.h" |
| 16 #include "base/command_line.h" | 16 #include "base/command_line.h" |
| 17 #include "content/public/browser/browser_thread.h" | 17 #include "content/public/browser/browser_thread.h" |
| 18 #include "content/public/browser/content_browser_client.h" | 18 #include "content/public/browser/content_browser_client.h" |
| 19 #include "content/public/browser/cookie_store_factory.h" | 19 #include "content/public/browser/cookie_store_factory.h" |
| 20 #include "content/public/common/content_client.h" | 20 #include "content/public/common/content_client.h" |
| 21 #include "content/public/common/content_constants.h" | |
| 21 #include "content/public/common/url_constants.h" | 22 #include "content/public/common/url_constants.h" |
| 22 #include "net/base/cache_type.h" | 23 #include "net/base/cache_type.h" |
| 23 #include "net/cookies/cookie_store.h" | 24 #include "net/cookies/cookie_store.h" |
| 24 #include "net/http/http_cache.h" | 25 #include "net/http/http_cache.h" |
| 25 #include "net/proxy/proxy_service.h" | 26 #include "net/proxy/proxy_service.h" |
| 26 #include "net/url_request/data_protocol_handler.h" | 27 #include "net/url_request/data_protocol_handler.h" |
| 27 #include "net/url_request/file_protocol_handler.h" | 28 #include "net/url_request/file_protocol_handler.h" |
| 28 #include "net/url_request/protocol_intercept_job_factory.h" | 29 #include "net/url_request/protocol_intercept_job_factory.h" |
| 29 #include "net/url_request/url_request_context_builder.h" | 30 #include "net/url_request/url_request_context_builder.h" |
| 30 #include "net/url_request/url_request_context.h" | 31 #include "net/url_request/url_request_context.h" |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 47 BrowserThread::SetDelegate(BrowserThread::IO, this); | 48 BrowserThread::SetDelegate(BrowserThread::IO, this); |
| 48 } | 49 } |
| 49 | 50 |
| 50 AwURLRequestContextGetter::~AwURLRequestContextGetter() { | 51 AwURLRequestContextGetter::~AwURLRequestContextGetter() { |
| 51 BrowserThread::SetDelegate(BrowserThread::IO, NULL); | 52 BrowserThread::SetDelegate(BrowserThread::IO, NULL); |
| 52 } | 53 } |
| 53 | 54 |
| 54 void AwURLRequestContextGetter::Init() { | 55 void AwURLRequestContextGetter::Init() { |
| 55 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 56 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 56 | 57 |
| 57 cookie_store_ = content::CreatePersistentCookieStore( | 58 // TODO(ajwong): Do we never drop session cookies? |
|
joth
2013/08/16 17:45:05
We don't - it's up to the embedder to do this via
awong
2013/08/17 00:32:52
Done.
| |
| 58 browser_context_->GetPath().Append(FILE_PATH_LITERAL("Cookies")), | 59 cookie_store_ = content::CreateCookieStore( |
| 59 true, | 60 content::CookieStoreConfig( |
| 60 NULL, | 61 browser_context_->GetPath().Append(content::kCookieFilename), |
| 61 NULL); | 62 content::CookieStoreConfig::RESTORED_SESSION_COOKIES, |
| 62 cookie_store_->GetCookieMonster()->SetPersistSessionCookies(true); | 63 NULL, |
| 64 NULL)); | |
| 63 | 65 |
| 64 // The CookieMonster must be passed here so it happens synchronously to | 66 // The CookieMonster must be passed here so it happens synchronously to |
| 65 // the main thread initialization (to avoid race condition in another | 67 // the main thread initialization (to avoid race condition in another |
| 66 // thread trying to access the CookieManager API). | 68 // thread trying to access the CookieManager API). |
| 67 DidCreateCookieMonster(cookie_store_->GetCookieMonster()); | 69 DidCreateCookieMonster(cookie_store_->GetCookieMonster()); |
| 68 } | 70 } |
| 69 | 71 |
| 70 void AwURLRequestContextGetter::InitAsync() { | 72 void AwURLRequestContextGetter::InitAsync() { |
| 71 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 73 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 72 | 74 |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 189 AwURLRequestContextGetter::GetNetworkTaskRunner() const { | 191 AwURLRequestContextGetter::GetNetworkTaskRunner() const { |
| 190 return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); | 192 return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); |
| 191 } | 193 } |
| 192 | 194 |
| 193 void AwURLRequestContextGetter::SetProtocolHandlers( | 195 void AwURLRequestContextGetter::SetProtocolHandlers( |
| 194 content::ProtocolHandlerMap* protocol_handlers) { | 196 content::ProtocolHandlerMap* protocol_handlers) { |
| 195 std::swap(protocol_handlers_, *protocol_handlers); | 197 std::swap(protocol_handlers_, *protocol_handlers); |
| 196 } | 198 } |
| 197 | 199 |
| 198 } // namespace android_webview | 200 } // namespace android_webview |
| OLD | NEW |