OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 "chrome/renderer/chrome_content_renderer_client.h" | 5 #include "chrome/renderer/chrome_content_renderer_client.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_heade
rs.h" | 69 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_heade
rs.h" |
70 #include "components/dom_distiller/content/renderer/distillability_agent.h" | 70 #include "components/dom_distiller/content/renderer/distillability_agent.h" |
71 #include "components/dom_distiller/content/renderer/distiller_js_render_frame_ob
server.h" | 71 #include "components/dom_distiller/content/renderer/distiller_js_render_frame_ob
server.h" |
72 #include "components/dom_distiller/core/dom_distiller_switches.h" | 72 #include "components/dom_distiller/core/dom_distiller_switches.h" |
73 #include "components/dom_distiller/core/url_constants.h" | 73 #include "components/dom_distiller/core/url_constants.h" |
74 #include "components/error_page/common/localized_error.h" | 74 #include "components/error_page/common/localized_error.h" |
75 #include "components/network_hints/renderer/prescient_networking_dispatcher.h" | 75 #include "components/network_hints/renderer/prescient_networking_dispatcher.h" |
76 #include "components/password_manager/content/renderer/credential_manager_client
.h" | 76 #include "components/password_manager/content/renderer/credential_manager_client
.h" |
77 #include "components/pdf/renderer/pepper_pdf_host.h" | 77 #include "components/pdf/renderer/pepper_pdf_host.h" |
78 #include "components/signin/core/common/profile_management_switches.h" | 78 #include "components/signin/core/common/profile_management_switches.h" |
| 79 #include "components/spellcheck/spellcheck_build_features.h" |
79 #include "components/startup_metric_utils/common/startup_metric.mojom.h" | 80 #include "components/startup_metric_utils/common/startup_metric.mojom.h" |
80 #include "components/subresource_filter/content/renderer/ruleset_dealer.h" | 81 #include "components/subresource_filter/content/renderer/ruleset_dealer.h" |
81 #include "components/subresource_filter/content/renderer/subresource_filter_agen
t.h" | 82 #include "components/subresource_filter/content/renderer/subresource_filter_agen
t.h" |
82 #include "components/version_info/version_info.h" | 83 #include "components/version_info/version_info.h" |
83 #include "components/visitedlink/renderer/visitedlink_slave.h" | 84 #include "components/visitedlink/renderer/visitedlink_slave.h" |
84 #include "components/web_cache/renderer/web_cache_impl.h" | 85 #include "components/web_cache/renderer/web_cache_impl.h" |
85 #include "content/public/common/content_constants.h" | 86 #include "content/public/common/content_constants.h" |
86 #include "content/public/common/content_switches.h" | 87 #include "content/public/common/content_switches.h" |
87 #include "content/public/common/url_constants.h" | 88 #include "content/public/common/url_constants.h" |
88 #include "content/public/renderer/plugin_instance_throttler.h" | 89 #include "content/public/renderer/plugin_instance_throttler.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 #include "chrome/common/chrome_content_client.h" | 146 #include "chrome/common/chrome_content_client.h" |
146 #include "chrome/renderer/printing/chrome_print_web_view_helper_delegate.h" | 147 #include "chrome/renderer/printing/chrome_print_web_view_helper_delegate.h" |
147 #include "components/printing/renderer/print_web_view_helper.h" | 148 #include "components/printing/renderer/print_web_view_helper.h" |
148 #include "printing/print_settings.h" | 149 #include "printing/print_settings.h" |
149 #endif | 150 #endif |
150 | 151 |
151 #if BUILDFLAG(ENABLE_PRINT_PREVIEW) | 152 #if BUILDFLAG(ENABLE_PRINT_PREVIEW) |
152 #include "chrome/renderer/pepper/chrome_pdf_print_client.h" | 153 #include "chrome/renderer/pepper/chrome_pdf_print_client.h" |
153 #endif | 154 #endif |
154 | 155 |
155 #if defined(ENABLE_SPELLCHECK) | 156 #if BUILDFLAG(ENABLE_SPELLCHECK) |
156 #include "components/spellcheck/renderer/spellcheck.h" | 157 #include "components/spellcheck/renderer/spellcheck.h" |
157 #include "components/spellcheck/renderer/spellcheck_provider.h" | 158 #include "components/spellcheck/renderer/spellcheck_provider.h" |
158 #endif | 159 #endif |
159 | 160 |
160 #if defined(ENABLE_WEBRTC) | 161 #if defined(ENABLE_WEBRTC) |
161 #include "chrome/renderer/media/webrtc_logging_message_filter.h" | 162 #include "chrome/renderer/media/webrtc_logging_message_filter.h" |
162 #endif | 163 #endif |
163 | 164 |
164 using autofill::AutofillAgent; | 165 using autofill::AutofillAgent; |
165 using autofill::PasswordAutofillAgent; | 166 using autofill::PasswordAutofillAgent; |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 for (size_t i = 0; i < additional_names.size(); ++i) { | 236 for (size_t i = 0; i < additional_names.size(); ++i) { |
236 names[existing_size + i] = additional_names[i]; | 237 names[existing_size + i] = additional_names[i]; |
237 values[existing_size + i] = additional_values[i]; | 238 values[existing_size + i] = additional_values[i]; |
238 } | 239 } |
239 | 240 |
240 existing_names->swap(names); | 241 existing_names->swap(names); |
241 existing_values->swap(values); | 242 existing_values->swap(values); |
242 } | 243 } |
243 #endif // defined(ENABLE_PLUGINS) | 244 #endif // defined(ENABLE_PLUGINS) |
244 | 245 |
245 #if defined(ENABLE_SPELLCHECK) | 246 #if BUILDFLAG(ENABLE_SPELLCHECK) |
246 class SpellCheckReplacer : public content::RenderViewVisitor { | 247 class SpellCheckReplacer : public content::RenderViewVisitor { |
247 public: | 248 public: |
248 explicit SpellCheckReplacer(SpellCheck* spellcheck) | 249 explicit SpellCheckReplacer(SpellCheck* spellcheck) |
249 : spellcheck_(spellcheck) {} | 250 : spellcheck_(spellcheck) {} |
250 bool Visit(content::RenderView* render_view) override; | 251 bool Visit(content::RenderView* render_view) override; |
251 | 252 |
252 private: | 253 private: |
253 SpellCheck* spellcheck_; // New shared spellcheck for all views. Weak Ptr. | 254 SpellCheck* spellcheck_; // New shared spellcheck for all views. Weak Ptr. |
254 DISALLOW_COPY_AND_ASSIGN(SpellCheckReplacer); | 255 DISALLOW_COPY_AND_ASSIGN(SpellCheckReplacer); |
255 }; | 256 }; |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 | 329 |
329 chrome_observer_.reset(new ChromeRenderThreadObserver()); | 330 chrome_observer_.reset(new ChromeRenderThreadObserver()); |
330 web_cache_impl_.reset(new web_cache::WebCacheImpl()); | 331 web_cache_impl_.reset(new web_cache::WebCacheImpl()); |
331 | 332 |
332 #if BUILDFLAG(ENABLE_EXTENSIONS) | 333 #if BUILDFLAG(ENABLE_EXTENSIONS) |
333 ChromeExtensionsRendererClient::GetInstance()->RenderThreadStarted(); | 334 ChromeExtensionsRendererClient::GetInstance()->RenderThreadStarted(); |
334 #endif | 335 #endif |
335 | 336 |
336 prescient_networking_dispatcher_.reset( | 337 prescient_networking_dispatcher_.reset( |
337 new network_hints::PrescientNetworkingDispatcher()); | 338 new network_hints::PrescientNetworkingDispatcher()); |
338 #if defined(ENABLE_SPELLCHECK) | 339 #if BUILDFLAG(ENABLE_SPELLCHECK) |
339 // ChromeRenderViewTest::SetUp() creates a Spellcheck and injects it using | 340 // ChromeRenderViewTest::SetUp() creates a Spellcheck and injects it using |
340 // SetSpellcheck(). Don't overwrite it. | 341 // SetSpellcheck(). Don't overwrite it. |
341 if (!spellcheck_) { | 342 if (!spellcheck_) { |
342 spellcheck_.reset(new SpellCheck()); | 343 spellcheck_.reset(new SpellCheck()); |
343 thread->AddObserver(spellcheck_.get()); | 344 thread->AddObserver(spellcheck_.get()); |
344 } | 345 } |
345 #endif | 346 #endif |
346 #if defined(FULL_SAFE_BROWSING) | 347 #if defined(FULL_SAFE_BROWSING) |
347 phishing_classifier_.reset(safe_browsing::PhishingClassifierFilter::Create()); | 348 phishing_classifier_.reset(safe_browsing::PhishingClassifierFilter::Create()); |
348 #endif | 349 #endif |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
520 void ChromeContentRendererClient::RenderViewCreated( | 521 void ChromeContentRendererClient::RenderViewCreated( |
521 content::RenderView* render_view) { | 522 content::RenderView* render_view) { |
522 #if BUILDFLAG(ENABLE_EXTENSIONS) | 523 #if BUILDFLAG(ENABLE_EXTENSIONS) |
523 ChromeExtensionsRendererClient::GetInstance()->RenderViewCreated(render_view); | 524 ChromeExtensionsRendererClient::GetInstance()->RenderViewCreated(render_view); |
524 #endif | 525 #endif |
525 #if BUILDFLAG(ENABLE_PRINTING) | 526 #if BUILDFLAG(ENABLE_PRINTING) |
526 new printing::PrintWebViewHelper( | 527 new printing::PrintWebViewHelper( |
527 render_view, std::unique_ptr<printing::PrintWebViewHelper::Delegate>( | 528 render_view, std::unique_ptr<printing::PrintWebViewHelper::Delegate>( |
528 new ChromePrintWebViewHelperDelegate())); | 529 new ChromePrintWebViewHelperDelegate())); |
529 #endif | 530 #endif |
530 #if defined(ENABLE_SPELLCHECK) | 531 #if BUILDFLAG(ENABLE_SPELLCHECK) |
531 new SpellCheckProvider(render_view, spellcheck_.get()); | 532 new SpellCheckProvider(render_view, spellcheck_.get()); |
532 #endif | 533 #endif |
533 new prerender::PrerendererClient(render_view); | 534 new prerender::PrerendererClient(render_view); |
534 | 535 |
535 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 536 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
536 if (command_line->HasSwitch(switches::kInstantProcess)) | 537 if (command_line->HasSwitch(switches::kInstantProcess)) |
537 new SearchBox(render_view); | 538 new SearchBox(render_view); |
538 | 539 |
539 new ChromeRenderViewObserver(render_view, web_cache_impl_.get()); | 540 new ChromeRenderViewObserver(render_view, web_cache_impl_.get()); |
540 | 541 |
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1170 bool ChromeContentRendererClient::ShouldOverridePageVisibilityState( | 1171 bool ChromeContentRendererClient::ShouldOverridePageVisibilityState( |
1171 const content::RenderFrame* render_frame, | 1172 const content::RenderFrame* render_frame, |
1172 blink::WebPageVisibilityState* override_state) { | 1173 blink::WebPageVisibilityState* override_state) { |
1173 if (!prerender::PrerenderHelper::IsPrerendering(render_frame)) | 1174 if (!prerender::PrerenderHelper::IsPrerendering(render_frame)) |
1174 return false; | 1175 return false; |
1175 | 1176 |
1176 *override_state = blink::WebPageVisibilityStatePrerender; | 1177 *override_state = blink::WebPageVisibilityStatePrerender; |
1177 return true; | 1178 return true; |
1178 } | 1179 } |
1179 | 1180 |
1180 #if defined(ENABLE_SPELLCHECK) | 1181 #if BUILDFLAG(ENABLE_SPELLCHECK) |
1181 void ChromeContentRendererClient::SetSpellcheck(SpellCheck* spellcheck) { | 1182 void ChromeContentRendererClient::SetSpellcheck(SpellCheck* spellcheck) { |
1182 RenderThread* thread = RenderThread::Get(); | 1183 RenderThread* thread = RenderThread::Get(); |
1183 if (spellcheck_.get() && thread) | 1184 if (spellcheck_.get() && thread) |
1184 thread->RemoveObserver(spellcheck_.get()); | 1185 thread->RemoveObserver(spellcheck_.get()); |
1185 spellcheck_.reset(spellcheck); | 1186 spellcheck_.reset(spellcheck); |
1186 SpellCheckReplacer replacer(spellcheck_.get()); | 1187 SpellCheckReplacer replacer(spellcheck_.get()); |
1187 content::RenderView::ForEach(&replacer); | 1188 content::RenderView::ForEach(&replacer); |
1188 if (thread) | 1189 if (thread) |
1189 thread->AddObserver(spellcheck_.get()); | 1190 thread->AddObserver(spellcheck_.get()); |
1190 } | 1191 } |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1469 | 1470 |
1470 url::Replacements<char> r; | 1471 url::Replacements<char> r; |
1471 r.SetPath(path.c_str(), url::Component(0, path.length())); | 1472 r.SetPath(path.c_str(), url::Component(0, path.length())); |
1472 | 1473 |
1473 if (result == internal::NUM_PLUGIN_ERROR) | 1474 if (result == internal::NUM_PLUGIN_ERROR) |
1474 result = invalid_url ? internal::SUCCESS_PARAMS_REWRITE : internal::SUCCESS; | 1475 result = invalid_url ? internal::SUCCESS_PARAMS_REWRITE : internal::SUCCESS; |
1475 | 1476 |
1476 RecordYouTubeRewriteUMA(result); | 1477 RecordYouTubeRewriteUMA(result); |
1477 return corrected_url.ReplaceComponents(r); | 1478 return corrected_url.ReplaceComponents(r); |
1478 } | 1479 } |
OLD | NEW |