summaryrefslogtreecommitdiffstats
path: root/android_webview/browser
diff options
context:
space:
mode:
Diffstat (limited to 'android_webview/browser')
-rw-r--r--android_webview/browser/renderer_host/aw_resource_dispatcher_host_delegate.cc44
-rw-r--r--android_webview/browser/renderer_host/aw_resource_dispatcher_host_delegate.h40
2 files changed, 84 insertions, 0 deletions
diff --git a/android_webview/browser/renderer_host/aw_resource_dispatcher_host_delegate.cc b/android_webview/browser/renderer_host/aw_resource_dispatcher_host_delegate.cc
new file mode 100644
index 0000000..9bf0bc2
--- /dev/null
+++ b/android_webview/browser/renderer_host/aw_resource_dispatcher_host_delegate.cc
@@ -0,0 +1,44 @@
+// 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.
+
+#include "android_webview/browser/renderer_host/aw_resource_dispatcher_host_delegate.h"
+
+#include "base/memory/scoped_ptr.h"
+#include "base/memory/scoped_vector.h"
+#include "content/public/browser/resource_dispatcher_host.h"
+#include "content/public/browser/resource_throttle.h"
+
+namespace {
+
+base::LazyInstance<android_webview::AwResourceDispatcherHostDelegate>
+ g_webview_resource_dispatcher_host_delegate = LAZY_INSTANCE_INITIALIZER;
+
+} // namespace
+
+namespace android_webview {
+
+// static
+void AwResourceDispatcherHostDelegate::ResourceDispatcherHostCreated() {
+ content::ResourceDispatcherHost::Get()->SetDelegate(
+ &g_webview_resource_dispatcher_host_delegate.Get());
+}
+
+AwResourceDispatcherHostDelegate::AwResourceDispatcherHostDelegate()
+ : content::ResourceDispatcherHostDelegate() {
+}
+
+AwResourceDispatcherHostDelegate::~AwResourceDispatcherHostDelegate() {
+}
+
+void AwResourceDispatcherHostDelegate::RequestBeginning(
+ net::URLRequest* request,
+ content::ResourceContext* resource_context,
+ ResourceType::Type resource_type,
+ int child_id,
+ int route_id,
+ bool is_continuation_of_transferred_request,
+ ScopedVector<content::ResourceThrottle>* throttles) {
+}
+
+}
diff --git a/android_webview/browser/renderer_host/aw_resource_dispatcher_host_delegate.h b/android_webview/browser/renderer_host/aw_resource_dispatcher_host_delegate.h
new file mode 100644
index 0000000..e7e4142
--- /dev/null
+++ b/android_webview/browser/renderer_host/aw_resource_dispatcher_host_delegate.h
@@ -0,0 +1,40 @@
+// 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_LIB_RENDERER_HOST_AW_RESOURCE_DISPATCHER_HOST_DELEGATE_H_
+#define ANDROID_WEBVIEW_LIB_RENDERER_HOST_AW_RESOURCE_DISPATCHER_HOST_DELEGATE_H_
+
+#include "content/public/browser/resource_dispatcher_host_delegate.h"
+
+#include "base/lazy_instance.h"
+
+namespace android_webview {
+
+class AwResourceDispatcherHostDelegate
+ : public content::ResourceDispatcherHostDelegate {
+ public:
+ static void ResourceDispatcherHostCreated();
+
+ // Overriden methods from ResourceDispatcherHostDelegate.
+ virtual void RequestBeginning(
+ net::URLRequest* request,
+ content::ResourceContext* resource_context,
+ ResourceType::Type resource_type,
+ int child_id,
+ int route_id,
+ bool is_continuation_of_transferred_request,
+ ScopedVector<content::ResourceThrottle>* throttles);
+
+ private:
+ friend struct base::DefaultLazyInstanceTraits<
+ AwResourceDispatcherHostDelegate>;
+ AwResourceDispatcherHostDelegate();
+ virtual ~AwResourceDispatcherHostDelegate();
+
+ DISALLOW_COPY_AND_ASSIGN(AwResourceDispatcherHostDelegate);
+};
+
+} // namespace android_webview
+
+#endif // ANDROID_WEBVIEW_LIB_RENDERER_HOST_AW_RESOURCE_DISPATCHER_HOST_H_