summaryrefslogtreecommitdiffstats
path: root/android_webview/browser/net
diff options
context:
space:
mode:
authorboliu@chromium.org <boliu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-01 13:53:14 +0000
committerboliu@chromium.org <boliu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-01 13:53:14 +0000
commit32f72e6f11a2a9a65ef50a674b838c66ee2c677d (patch)
tree2e8a00b68aff70e914f3a1278d994b313984abf5 /android_webview/browser/net
parent068d5f8c1e58499cc18359e8105bac0dff052396 (diff)
downloadchromium_src-32f72e6f11a2a9a65ef50a674b838c66ee2c677d.zip
chromium_src-32f72e6f11a2a9a65ef50a674b838c66ee2c677d.tar.gz
chromium_src-32f72e6f11a2a9a65ef50a674b838c66ee2c677d.tar.bz2
Pass CookieMonster to CookieManager in init
Add a static native callback header file in aw/browser/net and implemented in aw/native. CookieManager is rewritten to be a lazy-created singleton class so there is a place to hold the cookie monster without introducing a static initializer. BUG=157683 Android only change and ran through all android trybots NOTRY=true Review URL: https://chromiumcodereview.appspot.com/11368013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@165369 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'android_webview/browser/net')
-rw-r--r--android_webview/browser/net/aw_url_request_context_getter.cc6
-rw-r--r--android_webview/browser/net/init_native_callback.h23
-rw-r--r--android_webview/browser/net/register_android_protocols.h30
3 files changed, 27 insertions, 32 deletions
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 40d14b3..8fbe53c 100644
--- a/android_webview/browser/net/aw_url_request_context_getter.cc
+++ b/android_webview/browser/net/aw_url_request_context_getter.cc
@@ -8,7 +8,7 @@
#include "android_webview/browser/aw_request_interceptor.h"
#include "android_webview/browser/net/aw_network_delegate.h"
#include "android_webview/browser/net/aw_url_request_job_factory.h"
-#include "android_webview/browser/net/register_android_protocols.h"
+#include "android_webview/browser/net/init_native_callback.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/content_browser_client.h"
#include "content/public/browser/resource_context.h"
@@ -110,9 +110,11 @@ void AwURLRequestContextGetter::Init() {
set_protocol = job_factory_->SetProtocolHandler(
chrome::kDataScheme, new net::DataProtocolHandler());
DCHECK(set_protocol);
- RegisterAndroidProtocolsOnIOThread(job_factory_.get());
job_factory_->AddInterceptor(new AwRequestInterceptor());
url_request_context_->set_job_factory(job_factory_.get());
+
+ OnNetworkStackInitialized(url_request_context_.get(),
+ job_factory_.get());
}
content::ResourceContext* AwURLRequestContextGetter::GetResourceContext() {
diff --git a/android_webview/browser/net/init_native_callback.h b/android_webview/browser/net/init_native_callback.h
new file mode 100644
index 0000000..10588a1
--- /dev/null
+++ b/android_webview/browser/net/init_native_callback.h
@@ -0,0 +1,23 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef ANDROID_WEBVIEW_BROWSER_NET_INIT_NATIVE_CALLBACK_H_
+#define ANDROID_WEBVIEW_BROWSER_NET_INIT_NATIVE_CALLBACK_H_
+
+namespace net {
+class URLRequestContext;
+class URLRequestJobFactory;
+} // namespace net
+
+namespace android_webview {
+
+// This is called on the IO thread when the network URLRequestContext has been
+// initialized but not used. Note that the UI thread is blocked during this
+// call.
+void OnNetworkStackInitialized(net::URLRequestContext* context,
+ net::URLRequestJobFactory* job_factory);
+
+} // namespace android_webview
+
+#endif // ANDROID_WEBVIEW_BROWSER_NET_INIT_NATIVE_CALLBACK_H_
diff --git a/android_webview/browser/net/register_android_protocols.h b/android_webview/browser/net/register_android_protocols.h
deleted file mode 100644
index 1aa29f7..0000000
--- a/android_webview/browser/net/register_android_protocols.h
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef ANDROID_WEBVIEW_BROWSER_NET_ANDROID_PROTOCOL_HANDLER_H_
-#define ANDROID_WEBVIEW_BROWSER_NET_ANDROID_PROTOCOL_HANDLER_H_
-
-namespace net {
-class URLRequestJobFactory;
-} // namespace net
-
-namespace android_webview {
-
-// This class adds support for Android WebView-specific protocol schemes:
-//
-// - "content:" scheme is used for accessing data from Android content
-// providers, see http://developer.android.com/guide/topics/providers/
-// content-provider-basics.html#ContentURIs
-//
-// - "file:" scheme extension for accessing application assets and resources
-// (file:///android_asset/ and file:///android_res/), see
-// http://developer.android.com/reference/android/webkit/
-// WebSettings.html#setAllowFileAccess(boolean)
-//
-void RegisterAndroidProtocolsOnIOThread(
- net::URLRequestJobFactory* job_factory);
-
-} // namespace android_webview
-
-#endif // ANDROID_WEBVIEW_BROWSER_NET_ANDROID_PROTOCOL_HANDLER_H_