OLD | NEW |
---|---|
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/renderer/aw_content_renderer_client.h" | 5 #include "android_webview/renderer/aw_content_renderer_client.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "android_webview/common/aw_resource.h" | 9 #include "android_webview/common/aw_resource.h" |
10 #include "android_webview/common/aw_switches.h" | 10 #include "android_webview/common/aw_switches.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
45 #include "third_party/WebKit/public/platform/WebURLError.h" | 45 #include "third_party/WebKit/public/platform/WebURLError.h" |
46 #include "third_party/WebKit/public/platform/WebURLRequest.h" | 46 #include "third_party/WebKit/public/platform/WebURLRequest.h" |
47 #include "third_party/WebKit/public/web/WebFrame.h" | 47 #include "third_party/WebKit/public/web/WebFrame.h" |
48 #include "third_party/WebKit/public/web/WebNavigationType.h" | 48 #include "third_party/WebKit/public/web/WebNavigationType.h" |
49 #include "third_party/WebKit/public/web/WebSecurityPolicy.h" | 49 #include "third_party/WebKit/public/web/WebSecurityPolicy.h" |
50 #include "ui/base/l10n/l10n_util.h" | 50 #include "ui/base/l10n/l10n_util.h" |
51 #include "ui/base/resource/resource_bundle.h" | 51 #include "ui/base/resource/resource_bundle.h" |
52 #include "url/gurl.h" | 52 #include "url/gurl.h" |
53 #include "url/url_constants.h" | 53 #include "url/url_constants.h" |
54 | 54 |
55 #if defined(ENABLE_SPELLCHECK) | |
56 #include "components/spellcheck/renderer/spellcheck.h" | |
57 #include "components/spellcheck/renderer/spellcheck_provider.h" | |
58 #endif | |
59 | |
55 using content::RenderThread; | 60 using content::RenderThread; |
56 | 61 |
57 namespace android_webview { | 62 namespace android_webview { |
58 | 63 |
59 AwContentRendererClient::AwContentRendererClient() {} | 64 AwContentRendererClient::AwContentRendererClient() {} |
60 | 65 |
61 AwContentRendererClient::~AwContentRendererClient() {} | 66 AwContentRendererClient::~AwContentRendererClient() {} |
62 | 67 |
63 void AwContentRendererClient::RenderThreadStarted() { | 68 void AwContentRendererClient::RenderThreadStarted() { |
64 RenderThread* thread = RenderThread::Get(); | 69 RenderThread* thread = RenderThread::Get(); |
65 aw_render_thread_observer_.reset(new AwRenderThreadObserver); | 70 aw_render_thread_observer_.reset(new AwRenderThreadObserver); |
66 thread->AddObserver(aw_render_thread_observer_.get()); | 71 thread->AddObserver(aw_render_thread_observer_.get()); |
67 | 72 |
68 visited_link_slave_.reset(new visitedlink::VisitedLinkSlave); | 73 visited_link_slave_.reset(new visitedlink::VisitedLinkSlave); |
69 thread->AddObserver(visited_link_slave_.get()); | 74 thread->AddObserver(visited_link_slave_.get()); |
70 | 75 |
71 blink::WebString content_scheme(base::ASCIIToUTF16(url::kContentScheme)); | 76 blink::WebString content_scheme(base::ASCIIToUTF16(url::kContentScheme)); |
72 blink::WebSecurityPolicy::registerURLSchemeAsLocal(content_scheme); | 77 blink::WebSecurityPolicy::registerURLSchemeAsLocal(content_scheme); |
73 | 78 |
74 blink::WebString aw_scheme( | 79 blink::WebString aw_scheme( |
75 base::ASCIIToUTF16(android_webview::kAndroidWebViewVideoPosterScheme)); | 80 base::ASCIIToUTF16(android_webview::kAndroidWebViewVideoPosterScheme)); |
76 blink::WebSecurityPolicy::registerURLSchemeAsSecure(aw_scheme); | 81 blink::WebSecurityPolicy::registerURLSchemeAsSecure(aw_scheme); |
82 | |
83 #if defined(ENABLE_SPELLCHECK) | |
84 if (!spellcheck_) { | |
85 spellcheck_.reset(new SpellCheck()); | |
Tobias Sargeant
2016/08/23 14:17:58
base::MakeUnique<SpellCheck>()
timvolodine
2016/08/23 15:29:18
Done.
| |
86 thread->AddObserver(spellcheck_.get()); | |
87 } | |
88 #endif | |
77 } | 89 } |
78 | 90 |
79 bool AwContentRendererClient::HandleNavigation( | 91 bool AwContentRendererClient::HandleNavigation( |
80 content::RenderFrame* render_frame, | 92 content::RenderFrame* render_frame, |
81 bool is_content_initiated, | 93 bool is_content_initiated, |
82 int opener_id, | 94 int opener_id, |
83 blink::WebFrame* frame, | 95 blink::WebFrame* frame, |
84 const blink::WebURLRequest& request, | 96 const blink::WebURLRequest& request, |
85 blink::WebNavigationType type, | 97 blink::WebNavigationType type, |
86 blink::WebNavigationPolicy default_policy, | 98 blink::WebNavigationPolicy default_policy, |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
156 new autofill::AutofillAgent(render_frame, password_autofill_agent, NULL); | 168 new autofill::AutofillAgent(render_frame, password_autofill_agent, NULL); |
157 } | 169 } |
158 | 170 |
159 void AwContentRendererClient::RenderViewCreated( | 171 void AwContentRendererClient::RenderViewCreated( |
160 content::RenderView* render_view) { | 172 content::RenderView* render_view) { |
161 AwRenderViewExt::RenderViewCreated(render_view); | 173 AwRenderViewExt::RenderViewCreated(render_view); |
162 | 174 |
163 new printing::PrintWebViewHelper( | 175 new printing::PrintWebViewHelper( |
164 render_view, std::unique_ptr<printing::PrintWebViewHelper::Delegate>( | 176 render_view, std::unique_ptr<printing::PrintWebViewHelper::Delegate>( |
165 new AwPrintWebViewHelperDelegate())); | 177 new AwPrintWebViewHelperDelegate())); |
178 | |
179 #if defined(ENABLE_SPELLCHECK) | |
180 new SpellCheckProvider(render_view, spellcheck_.get()); | |
181 #endif | |
166 } | 182 } |
167 | 183 |
168 bool AwContentRendererClient::HasErrorPage(int http_status_code, | 184 bool AwContentRendererClient::HasErrorPage(int http_status_code, |
169 std::string* error_domain) { | 185 std::string* error_domain) { |
170 return http_status_code >= 400; | 186 return http_status_code >= 400; |
171 } | 187 } |
172 | 188 |
173 void AwContentRendererClient::GetNavigationErrorStrings( | 189 void AwContentRendererClient::GetNavigationErrorStrings( |
174 content::RenderFrame* render_frame, | 190 content::RenderFrame* render_frame, |
175 const blink::WebURLRequest& failed_request, | 191 const blink::WebURLRequest& failed_request, |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
260 for (auto* extension : kMediaPlayerExtensions) { | 276 for (auto* extension : kMediaPlayerExtensions) { |
261 if (base::EndsWith(url.path(), extension, | 277 if (base::EndsWith(url.path(), extension, |
262 base::CompareCase::INSENSITIVE_ASCII)) { | 278 base::CompareCase::INSENSITIVE_ASCII)) { |
263 return true; | 279 return true; |
264 } | 280 } |
265 } | 281 } |
266 return false; | 282 return false; |
267 } | 283 } |
268 | 284 |
269 } // namespace android_webview | 285 } // namespace android_webview |
OLD | NEW |