Catch Exception for Intent.parseUri instead of URISyntaxException
[chromium-blink-merge.git] / android_webview / browser / aw_content_browser_client.h
blob6d8852daf43e07bb5a0edfdc7227523ccee6930b
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_LIB_AW_CONTENT_BROWSER_CLIENT_H_
6 #define ANDROID_WEBVIEW_LIB_AW_CONTENT_BROWSER_CLIENT_H_
8 #include "android_webview/browser/aw_web_preferences_populater.h"
9 #include "base/basictypes.h"
10 #include "base/compiler_specific.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "content/public/browser/content_browser_client.h"
14 namespace android_webview {
16 class AwBrowserContext;
17 class JniDependencyFactory;
19 class AwContentBrowserClient : public content::ContentBrowserClient {
20 public:
21 // This is what AwContentBrowserClient::GetAcceptLangs uses.
22 static std::string GetAcceptLangsImpl();
24 // Deprecated: use AwBrowserContext::GetDefault() instead.
25 static AwBrowserContext* GetAwBrowserContext();
27 AwContentBrowserClient(JniDependencyFactory* native_factory);
28 ~AwContentBrowserClient() override;
30 // Overriden methods from ContentBrowserClient.
31 void AddCertificate(net::CertificateMimeType cert_type,
32 const void* cert_data,
33 size_t cert_size,
34 int render_process_id,
35 int render_frame_id) override;
36 content::BrowserMainParts* CreateBrowserMainParts(
37 const content::MainFunctionParams& parameters) override;
38 content::WebContentsViewDelegate* GetWebContentsViewDelegate(
39 content::WebContents* web_contents) override;
40 void RenderProcessWillLaunch(content::RenderProcessHost* host) override;
41 net::URLRequestContextGetter* CreateRequestContext(
42 content::BrowserContext* browser_context,
43 content::ProtocolHandlerMap* protocol_handlers,
44 content::URLRequestInterceptorScopedVector request_interceptors) override;
45 net::URLRequestContextGetter* CreateRequestContextForStoragePartition(
46 content::BrowserContext* browser_context,
47 const base::FilePath& partition_path,
48 bool in_memory,
49 content::ProtocolHandlerMap* protocol_handlers,
50 content::URLRequestInterceptorScopedVector request_interceptors) override;
51 std::string GetCanonicalEncodingNameByAliasName(
52 const std::string& alias_name) override;
53 void AppendExtraCommandLineSwitches(base::CommandLine* command_line,
54 int child_process_id) override;
55 std::string GetApplicationLocale() override;
56 std::string GetAcceptLangs(content::BrowserContext* context) override;
57 const gfx::ImageSkia* GetDefaultFavicon() override;
58 bool AllowAppCache(const GURL& manifest_url,
59 const GURL& first_party,
60 content::ResourceContext* context) override;
61 bool AllowGetCookie(const GURL& url,
62 const GURL& first_party,
63 const net::CookieList& cookie_list,
64 content::ResourceContext* context,
65 int render_process_id,
66 int render_frame_id) override;
67 bool AllowSetCookie(const GURL& url,
68 const GURL& first_party,
69 const std::string& cookie_line,
70 content::ResourceContext* context,
71 int render_process_id,
72 int render_frame_id,
73 net::CookieOptions* options) override;
74 bool AllowWorkerDatabase(
75 const GURL& url,
76 const base::string16& name,
77 const base::string16& display_name,
78 unsigned long estimated_size,
79 content::ResourceContext* context,
80 const std::vector<std::pair<int, int>>& render_frames) override;
81 void AllowWorkerFileSystem(
82 const GURL& url,
83 content::ResourceContext* context,
84 const std::vector<std::pair<int, int>>& render_frames,
85 base::Callback<void(bool)> callback) override;
86 bool AllowWorkerIndexedDB(
87 const GURL& url,
88 const base::string16& name,
89 content::ResourceContext* context,
90 const std::vector<std::pair<int, int>>& render_frames) override;
91 content::QuotaPermissionContext* CreateQuotaPermissionContext() override;
92 void AllowCertificateError(
93 int render_process_id,
94 int render_frame_id,
95 int cert_error,
96 const net::SSLInfo& ssl_info,
97 const GURL& request_url,
98 content::ResourceType resource_type,
99 bool overridable,
100 bool strict_enforcement,
101 bool expired_previous_decision,
102 const base::Callback<void(bool)>& callback,
103 content::CertificateRequestResultType* result) override;
104 void SelectClientCertificate(
105 content::WebContents* web_contents,
106 net::SSLCertRequestInfo* cert_request_info,
107 scoped_ptr<content::ClientCertificateDelegate> delegate) override;
108 bool CanCreateWindow(const GURL& opener_url,
109 const GURL& opener_top_level_frame_url,
110 const GURL& source_origin,
111 WindowContainerType container_type,
112 const GURL& target_url,
113 const content::Referrer& referrer,
114 WindowOpenDisposition disposition,
115 const blink::WebWindowFeatures& features,
116 bool user_gesture,
117 bool opener_suppressed,
118 content::ResourceContext* context,
119 int render_process_id,
120 int opener_id,
121 bool* no_javascript_access) override;
122 void ResourceDispatcherHostCreated() override;
123 net::NetLog* GetNetLog() override;
124 content::AccessTokenStore* CreateAccessTokenStore() override;
125 bool IsFastShutdownPossible() override;
126 void ClearCache(content::RenderFrameHost* rfh) override;
127 void ClearCookies(content::RenderFrameHost* rfh) override;
128 base::FilePath GetDefaultDownloadDirectory() override;
129 std::string GetDefaultDownloadName() override;
130 void DidCreatePpapiPlugin(content::BrowserPpapiHost* browser_host) override;
131 bool AllowPepperSocketAPI(
132 content::BrowserContext* browser_context,
133 const GURL& url,
134 bool private_api,
135 const content::SocketPermissionRequest* params) override;
136 void OverrideWebkitPrefs(content::RenderViewHost* rvh,
137 content::WebPreferences* web_prefs) override;
138 #if defined(VIDEO_HOLE)
139 content::ExternalVideoSurfaceContainer*
140 OverrideCreateExternalVideoSurfaceContainer(
141 content::WebContents* web_contents) override;
142 #endif
144 private:
145 // Android WebView currently has a single global (non-off-the-record) browser
146 // context.
147 scoped_ptr<AwBrowserContext> browser_context_;
148 scoped_ptr<AwWebPreferencesPopulater> preferences_populater_;
150 JniDependencyFactory* native_factory_;
152 DISALLOW_COPY_AND_ASSIGN(AwContentBrowserClient);
155 } // namespace android_webview
157 #endif // ANDROID_WEBVIEW_LIB_AW_CONTENT_BROWSER_CLIENT_H_