Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(321)

Side by Side Diff: content/renderer/render_frame_impl.cc

Issue 975533002: Move didClearWindowObject to RenderFrame. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | content/renderer/render_view_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "content/renderer/render_frame_impl.h" 5 #include "content/renderer/render_frame_impl.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/debug/alias.h" 12 #include "base/debug/alias.h"
13 #include "base/debug/asan_invalid_access.h" 13 #include "base/debug/asan_invalid_access.h"
14 #include "base/debug/dump_without_crashing.h" 14 #include "base/debug/dump_without_crashing.h"
15 #include "base/i18n/char_iterator.h" 15 #include "base/i18n/char_iterator.h"
16 #include "base/metrics/histogram.h" 16 #include "base/metrics/histogram.h"
17 #include "base/process/kill.h" 17 #include "base/process/kill.h"
18 #include "base/process/process.h" 18 #include "base/process/process.h"
19 #include "base/strings/string16.h" 19 #include "base/strings/string16.h"
20 #include "base/strings/utf_string_conversions.h" 20 #include "base/strings/utf_string_conversions.h"
21 #include "base/time/time.h" 21 #include "base/time/time.h"
22 #include "cc/base/switches.h"
22 #include "content/child/appcache/appcache_dispatcher.h" 23 #include "content/child/appcache/appcache_dispatcher.h"
23 #include "content/child/plugin_messages.h" 24 #include "content/child/plugin_messages.h"
24 #include "content/child/quota_dispatcher.h" 25 #include "content/child/quota_dispatcher.h"
25 #include "content/child/request_extra_data.h" 26 #include "content/child/request_extra_data.h"
26 #include "content/child/service_worker/service_worker_handle_reference.h" 27 #include "content/child/service_worker/service_worker_handle_reference.h"
27 #include "content/child/service_worker/service_worker_network_provider.h" 28 #include "content/child/service_worker/service_worker_network_provider.h"
28 #include "content/child/service_worker/service_worker_provider_context.h" 29 #include "content/child/service_worker/service_worker_provider_context.h"
29 #include "content/child/service_worker/web_service_worker_provider_impl.h" 30 #include "content/child/service_worker/web_service_worker_provider_impl.h"
30 #include "content/child/v8_value_converter_impl.h" 31 #include "content/child/v8_value_converter_impl.h"
31 #include "content/child/web_url_loader_impl.h" 32 #include "content/child/web_url_loader_impl.h"
(...skipping 26 matching lines...) Expand all
58 #include "content/renderer/accessibility/renderer_accessibility.h" 59 #include "content/renderer/accessibility/renderer_accessibility.h"
59 #include "content/renderer/browser_plugin/browser_plugin.h" 60 #include "content/renderer/browser_plugin/browser_plugin.h"
60 #include "content/renderer/browser_plugin/browser_plugin_manager.h" 61 #include "content/renderer/browser_plugin/browser_plugin_manager.h"
61 #include "content/renderer/child_frame_compositing_helper.h" 62 #include "content/renderer/child_frame_compositing_helper.h"
62 #include "content/renderer/context_menu_params_builder.h" 63 #include "content/renderer/context_menu_params_builder.h"
63 #include "content/renderer/devtools/devtools_agent.h" 64 #include "content/renderer/devtools/devtools_agent.h"
64 #include "content/renderer/dom_automation_controller.h" 65 #include "content/renderer/dom_automation_controller.h"
65 #include "content/renderer/dom_utils.h" 66 #include "content/renderer/dom_utils.h"
66 #include "content/renderer/external_popup_menu.h" 67 #include "content/renderer/external_popup_menu.h"
67 #include "content/renderer/geolocation_dispatcher.h" 68 #include "content/renderer/geolocation_dispatcher.h"
69 #include "content/renderer/gpu/gpu_benchmarking_extension.h"
68 #include "content/renderer/history_controller.h" 70 #include "content/renderer/history_controller.h"
69 #include "content/renderer/history_serialization.h" 71 #include "content/renderer/history_serialization.h"
70 #include "content/renderer/image_loading_helper.h" 72 #include "content/renderer/image_loading_helper.h"
71 #include "content/renderer/ime_event_guard.h" 73 #include "content/renderer/ime_event_guard.h"
72 #include "content/renderer/internal_document_state_data.h" 74 #include "content/renderer/internal_document_state_data.h"
73 #include "content/renderer/manifest/manifest_manager.h" 75 #include "content/renderer/manifest/manifest_manager.h"
74 #include "content/renderer/media/audio_renderer_mixer_manager.h" 76 #include "content/renderer/media/audio_renderer_mixer_manager.h"
75 #include "content/renderer/media/crypto/render_cdm_factory.h" 77 #include "content/renderer/media/crypto/render_cdm_factory.h"
76 #include "content/renderer/media/media_permission_dispatcher.h" 78 #include "content/renderer/media/media_permission_dispatcher.h"
77 #include "content/renderer/media/media_stream_dispatcher.h" 79 #include "content/renderer/media/media_stream_dispatcher.h"
78 #include "content/renderer/media/media_stream_renderer_factory.h" 80 #include "content/renderer/media/media_stream_renderer_factory.h"
79 #include "content/renderer/media/midi_dispatcher.h" 81 #include "content/renderer/media/midi_dispatcher.h"
80 #include "content/renderer/media/render_media_log.h" 82 #include "content/renderer/media/render_media_log.h"
81 #include "content/renderer/media/user_media_client_impl.h" 83 #include "content/renderer/media/user_media_client_impl.h"
82 #include "content/renderer/media/webmediaplayer_ms.h" 84 #include "content/renderer/media/webmediaplayer_ms.h"
85 #include "content/renderer/memory_benchmarking_extension.h"
83 #include "content/renderer/mojo/service_registry_js_wrapper.h" 86 #include "content/renderer/mojo/service_registry_js_wrapper.h"
84 #include "content/renderer/notification_permission_dispatcher.h" 87 #include "content/renderer/notification_permission_dispatcher.h"
85 #include "content/renderer/npapi/plugin_channel_host.h" 88 #include "content/renderer/npapi/plugin_channel_host.h"
86 #include "content/renderer/pepper/plugin_instance_throttler_impl.h" 89 #include "content/renderer/pepper/plugin_instance_throttler_impl.h"
87 #include "content/renderer/presentation/presentation_dispatcher.h" 90 #include "content/renderer/presentation/presentation_dispatcher.h"
88 #include "content/renderer/push_messaging/push_messaging_dispatcher.h" 91 #include "content/renderer/push_messaging/push_messaging_dispatcher.h"
89 #include "content/renderer/render_frame_proxy.h" 92 #include "content/renderer/render_frame_proxy.h"
90 #include "content/renderer/render_process.h" 93 #include "content/renderer/render_process.h"
91 #include "content/renderer/render_thread_impl.h" 94 #include "content/renderer/render_thread_impl.h"
92 #include "content/renderer/render_view_impl.h" 95 #include "content/renderer/render_view_impl.h"
93 #include "content/renderer/render_widget_fullscreen_pepper.h" 96 #include "content/renderer/render_widget_fullscreen_pepper.h"
94 #include "content/renderer/renderer_webapplicationcachehost_impl.h" 97 #include "content/renderer/renderer_webapplicationcachehost_impl.h"
95 #include "content/renderer/renderer_webcolorchooser_impl.h" 98 #include "content/renderer/renderer_webcolorchooser_impl.h"
96 #include "content/renderer/screen_orientation/screen_orientation_dispatcher.h" 99 #include "content/renderer/screen_orientation/screen_orientation_dispatcher.h"
97 #include "content/renderer/shared_worker_repository.h" 100 #include "content/renderer/shared_worker_repository.h"
101 #include "content/renderer/skia_benchmarking_extension.h"
102 #include "content/renderer/stats_collection_controller.h"
103 #include "content/renderer/web_ui_extension.h"
98 #include "content/renderer/websharedworker_proxy.h" 104 #include "content/renderer/websharedworker_proxy.h"
99 #include "gin/modules/module_registry.h" 105 #include "gin/modules/module_registry.h"
100 #include "media/base/audio_renderer_mixer_input.h" 106 #include "media/base/audio_renderer_mixer_input.h"
101 #include "media/base/media_log.h" 107 #include "media/base/media_log.h"
102 #include "media/blink/webencryptedmediaclient_impl.h" 108 #include "media/blink/webencryptedmediaclient_impl.h"
103 #include "media/blink/webmediaplayer_impl.h" 109 #include "media/blink/webmediaplayer_impl.h"
104 #include "media/blink/webmediaplayer_params.h" 110 #include "media/blink/webmediaplayer_params.h"
105 #include "media/filters/gpu_video_accelerator_factories.h" 111 #include "media/filters/gpu_video_accelerator_factories.h"
106 #include "net/base/data_url.h" 112 #include "net/base/data_url.h"
107 #include "net/base/net_errors.h" 113 #include "net/base/net_errors.h"
(...skipping 2442 matching lines...) Expand 10 before | Expand all | Expand 10 after
2550 2556
2551 void RenderFrameImpl::didCreateNewDocument(blink::WebLocalFrame* frame) { 2557 void RenderFrameImpl::didCreateNewDocument(blink::WebLocalFrame* frame) {
2552 DCHECK(!frame_ || frame_ == frame); 2558 DCHECK(!frame_ || frame_ == frame);
2553 2559
2554 FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(), 2560 FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(),
2555 DidCreateNewDocument(frame)); 2561 DidCreateNewDocument(frame));
2556 } 2562 }
2557 2563
2558 void RenderFrameImpl::didClearWindowObject(blink::WebLocalFrame* frame) { 2564 void RenderFrameImpl::didClearWindowObject(blink::WebLocalFrame* frame) {
2559 DCHECK(!frame_ || frame_ == frame); 2565 DCHECK(!frame_ || frame_ == frame);
2560 // TODO(nasko): Move implementation here. Needed state:
2561 // * enabled_bindings_
2562 // * dom_automation_controller_
2563 // * stats_collection_controller_
2564 2566
2565 render_view_->didClearWindowObject(frame); 2567 int enabled_bindings = render_view_->GetEnabledBindings();
2566 2568
2567 if (render_view_->GetEnabledBindings() & BINDINGS_POLICY_DOM_AUTOMATION) 2569 if (enabled_bindings & BINDINGS_POLICY_WEB_UI)
2570 WebUIExtension::Install(frame);
2571
2572 if (enabled_bindings & BINDINGS_POLICY_DOM_AUTOMATION)
2568 DomAutomationController::Install(this, frame); 2573 DomAutomationController::Install(this, frame);
2569 2574
2575 if (enabled_bindings & BINDINGS_POLICY_STATS_COLLECTION)
2576 StatsCollectionController::Install(frame);
2577
2578 const base::CommandLine& command_line =
2579 *base::CommandLine::ForCurrentProcess();
2580
2581 if (command_line.HasSwitch(cc::switches::kEnableGpuBenchmarking))
2582 GpuBenchmarking::Install(frame);
2583
2584 if (command_line.HasSwitch(switches::kEnableMemoryBenchmarking))
2585 MemoryBenchmarkingExtension::Install(frame);
2586
2587 if (command_line.HasSwitch(switches::kEnableSkiaBenchmarking))
2588 SkiaBenchmarking::Install(frame);
2589
2590 FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(),
nasko 2015/03/02 23:06:37 Shouldn't this be moved to be the first code in th
2591 DidClearWindowObject(frame));
2570 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, DidClearWindowObject()); 2592 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, DidClearWindowObject());
2571 } 2593 }
2572 2594
2573 void RenderFrameImpl::didCreateDocumentElement(blink::WebLocalFrame* frame) { 2595 void RenderFrameImpl::didCreateDocumentElement(blink::WebLocalFrame* frame) {
2574 DCHECK(!frame_ || frame_ == frame); 2596 DCHECK(!frame_ || frame_ == frame);
2575 2597
2576 // Notify the browser about non-blank documents loading in the top frame. 2598 // Notify the browser about non-blank documents loading in the top frame.
2577 GURL url = frame->document().url(); 2599 GURL url = frame->document().url();
2578 if (url.is_valid() && url.spec() != url::kAboutBlankURL) { 2600 if (url.is_valid() && url.spec() != url::kAboutBlankURL) {
2579 // TODO(nasko): Check if webview()->mainFrame() is the same as the 2601 // TODO(nasko): Check if webview()->mainFrame() is the same as the
(...skipping 1875 matching lines...) Expand 10 before | Expand all | Expand 10 after
4455 4477
4456 #if defined(ENABLE_BROWSER_CDMS) 4478 #if defined(ENABLE_BROWSER_CDMS)
4457 RendererCdmManager* RenderFrameImpl::GetCdmManager() { 4479 RendererCdmManager* RenderFrameImpl::GetCdmManager() {
4458 if (!cdm_manager_) 4480 if (!cdm_manager_)
4459 cdm_manager_ = new RendererCdmManager(this); 4481 cdm_manager_ = new RendererCdmManager(this);
4460 return cdm_manager_; 4482 return cdm_manager_;
4461 } 4483 }
4462 #endif // defined(ENABLE_BROWSER_CDMS) 4484 #endif // defined(ENABLE_BROWSER_CDMS)
4463 4485
4464 } // namespace content 4486 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/renderer/render_view_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698