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
3 // found in the LICENSE file.
5 #ifndef ANDROID_WEBVIEW_NATIVE_AW_CONTENTS_IO_THREAD_CLIENT_IMPL_H_
6 #define ANDROID_WEBVIEW_NATIVE_AW_CONTENTS_IO_THREAD_CLIENT_IMPL_H_
8 #include "android_webview/browser/aw_contents_io_thread_client.h"
10 #include "base/android/scoped_java_ref.h"
11 #include "base/basictypes.h"
12 #include "base/compiler_specific.h"
13 #include "base/memory/scoped_ptr.h"
25 namespace android_webview
{
27 class InterceptedRequestData
;
29 class AwContentsIoThreadClientImpl
: public AwContentsIoThreadClient
{
31 // Associates the |jclient| instance (which must implement the
32 // AwContentsIoThreadClient Java interface) with the |web_contents|.
33 // This should be called at most once per |web_contents|.
34 static void Associate(content::WebContents
* web_contents
,
35 const base::android::JavaRef
<jobject
>& jclient
);
37 AwContentsIoThreadClientImpl(const base::android::JavaRef
<jobject
>& jclient
);
38 virtual ~AwContentsIoThreadClientImpl() OVERRIDE
;
40 // Implementation of AwContentsIoThreadClient.
41 virtual CacheMode
GetCacheMode() const OVERRIDE
;
42 virtual scoped_ptr
<InterceptedRequestData
> ShouldInterceptRequest(
44 const net::URLRequest
* request
) OVERRIDE
;
45 virtual bool ShouldBlockContentUrls() const OVERRIDE
;
46 virtual bool ShouldBlockFileUrls() const OVERRIDE
;
47 virtual bool ShouldBlockNetworkLoads() const OVERRIDE
;
48 virtual void NewDownload(const GURL
& url
,
49 const std::string
& user_agent
,
50 const std::string
& content_disposition
,
51 const std::string
& mime_type
,
52 int64 content_length
) OVERRIDE
;
53 virtual void NewLoginRequest(const std::string
& realm
,
54 const std::string
& account
,
55 const std::string
& args
) OVERRIDE
;
58 base::android::ScopedJavaGlobalRef
<jobject
> java_object_
;
60 DISALLOW_COPY_AND_ASSIGN(AwContentsIoThreadClientImpl
);
63 // JNI registration method.
64 bool RegisterAwContentsIoThreadClientImpl(JNIEnv
* env
);
66 } // namespace android_webview
68 #endif // ANDROID_WEBVIEW_NATIVE_AW_CONTENTS_IO_THREAD_CLIENT_IMPL_H_