OLD | NEW |
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 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 #include "third_party/WebKit/public/web/WebSerializedScriptValue.h" | 202 #include "third_party/WebKit/public/web/WebSerializedScriptValue.h" |
203 #include "third_party/WebKit/public/web/WebSettings.h" | 203 #include "third_party/WebKit/public/web/WebSettings.h" |
204 #include "third_party/WebKit/public/web/WebSurroundingText.h" | 204 #include "third_party/WebKit/public/web/WebSurroundingText.h" |
205 #include "third_party/WebKit/public/web/WebUserGestureIndicator.h" | 205 #include "third_party/WebKit/public/web/WebUserGestureIndicator.h" |
206 #include "third_party/WebKit/public/web/WebView.h" | 206 #include "third_party/WebKit/public/web/WebView.h" |
207 #include "third_party/WebKit/public/web/WebWidget.h" | 207 #include "third_party/WebKit/public/web/WebWidget.h" |
208 #include "url/origin.h" | 208 #include "url/origin.h" |
209 #include "url/url_constants.h" | 209 #include "url/url_constants.h" |
210 #include "url/url_util.h" | 210 #include "url/url_util.h" |
211 | 211 |
212 #if defined(ENABLE_PLUGINS) | 212 #if BUILDFLAG(ENABLE_PLUGINS) |
213 #include "content/renderer/pepper/pepper_browser_connection.h" | 213 #include "content/renderer/pepper/pepper_browser_connection.h" |
214 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" | 214 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" |
215 #include "content/renderer/pepper/pepper_plugin_registry.h" | 215 #include "content/renderer/pepper/pepper_plugin_registry.h" |
216 #include "content/renderer/pepper/pepper_webplugin_impl.h" | 216 #include "content/renderer/pepper/pepper_webplugin_impl.h" |
217 #include "content/renderer/pepper/plugin_module.h" | 217 #include "content/renderer/pepper/plugin_module.h" |
218 #endif | 218 #endif |
219 | 219 |
220 #if defined(ENABLE_WEBRTC) | 220 #if defined(ENABLE_WEBRTC) |
221 #include "content/renderer/media/rtc_peer_connection_handler.h" | 221 #include "content/renderer/media/rtc_peer_connection_handler.h" |
222 #endif | 222 #endif |
(...skipping 852 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1075 | 1075 |
1076 // RenderFrameImpl ---------------------------------------------------------- | 1076 // RenderFrameImpl ---------------------------------------------------------- |
1077 RenderFrameImpl::RenderFrameImpl(const CreateParams& params) | 1077 RenderFrameImpl::RenderFrameImpl(const CreateParams& params) |
1078 : frame_(NULL), | 1078 : frame_(NULL), |
1079 is_main_frame_(true), | 1079 is_main_frame_(true), |
1080 in_browser_initiated_detach_(false), | 1080 in_browser_initiated_detach_(false), |
1081 in_frame_tree_(false), | 1081 in_frame_tree_(false), |
1082 render_view_(params.render_view), | 1082 render_view_(params.render_view), |
1083 routing_id_(params.routing_id), | 1083 routing_id_(params.routing_id), |
1084 proxy_routing_id_(MSG_ROUTING_NONE), | 1084 proxy_routing_id_(MSG_ROUTING_NONE), |
1085 #if defined(ENABLE_PLUGINS) | 1085 #if BUILDFLAG(ENABLE_PLUGINS) |
1086 plugin_power_saver_helper_(nullptr), | 1086 plugin_power_saver_helper_(nullptr), |
1087 plugin_find_handler_(nullptr), | 1087 plugin_find_handler_(nullptr), |
1088 #endif | 1088 #endif |
1089 cookie_jar_(this), | 1089 cookie_jar_(this), |
1090 selection_text_offset_(0), | 1090 selection_text_offset_(0), |
1091 selection_range_(gfx::Range::InvalidRange()), | 1091 selection_range_(gfx::Range::InvalidRange()), |
1092 handling_select_range_(false), | 1092 handling_select_range_(false), |
1093 web_user_media_client_(NULL), | 1093 web_user_media_client_(NULL), |
1094 #if defined(OS_ANDROID) | 1094 #if defined(OS_ANDROID) |
1095 media_player_manager_(NULL), | 1095 media_player_manager_(NULL), |
1096 media_session_manager_(NULL), | 1096 media_session_manager_(NULL), |
1097 #endif | 1097 #endif |
1098 media_surface_manager_(nullptr), | 1098 media_surface_manager_(nullptr), |
1099 devtools_agent_(nullptr), | 1099 devtools_agent_(nullptr), |
1100 push_messaging_dispatcher_(NULL), | 1100 push_messaging_dispatcher_(NULL), |
1101 presentation_dispatcher_(NULL), | 1101 presentation_dispatcher_(NULL), |
1102 screen_orientation_dispatcher_(NULL), | 1102 screen_orientation_dispatcher_(NULL), |
1103 manifest_manager_(NULL), | 1103 manifest_manager_(NULL), |
1104 accessibility_mode_(AccessibilityModeOff), | 1104 accessibility_mode_(AccessibilityModeOff), |
1105 render_accessibility_(NULL), | 1105 render_accessibility_(NULL), |
1106 media_player_delegate_(NULL), | 1106 media_player_delegate_(NULL), |
1107 is_using_lofi_(false), | 1107 is_using_lofi_(false), |
1108 effective_connection_type_( | 1108 effective_connection_type_( |
1109 blink::WebEffectiveConnectionType::TypeUnknown), | 1109 blink::WebEffectiveConnectionType::TypeUnknown), |
1110 is_pasting_(false), | 1110 is_pasting_(false), |
1111 suppress_further_dialogs_(false), | 1111 suppress_further_dialogs_(false), |
1112 blame_context_(nullptr), | 1112 blame_context_(nullptr), |
1113 #if defined(ENABLE_PLUGINS) | 1113 #if BUILDFLAG(ENABLE_PLUGINS) |
1114 focused_pepper_plugin_(nullptr), | 1114 focused_pepper_plugin_(nullptr), |
1115 pepper_last_mouse_event_target_(nullptr), | 1115 pepper_last_mouse_event_target_(nullptr), |
1116 #endif | 1116 #endif |
1117 frame_binding_(this), | 1117 frame_binding_(this), |
1118 host_zoom_binding_(this), | 1118 host_zoom_binding_(this), |
1119 has_accessed_initial_document_(false), | 1119 has_accessed_initial_document_(false), |
1120 weak_factory_(this) { | 1120 weak_factory_(this) { |
1121 // We don't have a service_manager::Connection at this point, so use empty | 1121 // We don't have a service_manager::Connection at this point, so use empty |
1122 // identity/specs. | 1122 // identity/specs. |
1123 // TODO(beng): We should fix this, so we can apply policy about which | 1123 // TODO(beng): We should fix this, so we can apply policy about which |
(...skipping 16 matching lines...) Expand all Loading... |
1140 RenderThread::Get()->AddRoute(routing_id_, this); | 1140 RenderThread::Get()->AddRoute(routing_id_, this); |
1141 | 1141 |
1142 render_view_->RegisterRenderFrame(this); | 1142 render_view_->RegisterRenderFrame(this); |
1143 | 1143 |
1144 // Everything below subclasses RenderFrameObserver and is automatically | 1144 // Everything below subclasses RenderFrameObserver and is automatically |
1145 // deleted when the RenderFrame gets deleted. | 1145 // deleted when the RenderFrame gets deleted. |
1146 #if defined(OS_ANDROID) | 1146 #if defined(OS_ANDROID) |
1147 new GinJavaBridgeDispatcher(this); | 1147 new GinJavaBridgeDispatcher(this); |
1148 #endif | 1148 #endif |
1149 | 1149 |
1150 #if defined(ENABLE_PLUGINS) | 1150 #if BUILDFLAG(ENABLE_PLUGINS) |
1151 // Manages its own lifetime. | 1151 // Manages its own lifetime. |
1152 plugin_power_saver_helper_ = new PluginPowerSaverHelper(this); | 1152 plugin_power_saver_helper_ = new PluginPowerSaverHelper(this); |
1153 #endif | 1153 #endif |
1154 | 1154 |
1155 manifest_manager_ = new ManifestManager(this); | 1155 manifest_manager_ = new ManifestManager(this); |
1156 | 1156 |
1157 #if BUILDFLAG(ENABLE_MEDIA_REMOTING) | 1157 #if BUILDFLAG(ENABLE_MEDIA_REMOTING) |
1158 // Create the RemotingSinkObserver to monitor the remoting sink availablity. | 1158 // Create the RemotingSinkObserver to monitor the remoting sink availablity. |
1159 media::mojom::RemotingSourcePtr remoting_source; | 1159 media::mojom::RemotingSourcePtr remoting_source; |
1160 media::mojom::RemotingSourceRequest remoting_source_request = | 1160 media::mojom::RemotingSourceRequest remoting_source_request = |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1230 TRACE_EVENT_CATEGORY_GROUP_ENABLED("rail", &is_tracing_rail); | 1230 TRACE_EVENT_CATEGORY_GROUP_ENABLED("rail", &is_tracing_rail); |
1231 if (is_tracing_rail || is_tracing_navigation) { | 1231 if (is_tracing_rail || is_tracing_navigation) { |
1232 int parent_id = GetRoutingIdForFrameOrProxy(frame_->parent()); | 1232 int parent_id = GetRoutingIdForFrameOrProxy(frame_->parent()); |
1233 TRACE_EVENT2("navigation,rail", "RenderFrameImpl::Initialize", | 1233 TRACE_EVENT2("navigation,rail", "RenderFrameImpl::Initialize", |
1234 "id", routing_id_, | 1234 "id", routing_id_, |
1235 "parent", parent_id); | 1235 "parent", parent_id); |
1236 } | 1236 } |
1237 | 1237 |
1238 MaybeEnableMojoBindings(); | 1238 MaybeEnableMojoBindings(); |
1239 | 1239 |
1240 #if defined(ENABLE_PLUGINS) | 1240 #if BUILDFLAG(ENABLE_PLUGINS) |
1241 new PepperBrowserConnection(this); | 1241 new PepperBrowserConnection(this); |
1242 #endif | 1242 #endif |
1243 new SharedWorkerRepository(this); | 1243 new SharedWorkerRepository(this); |
1244 | 1244 |
1245 if (IsLocalRoot()) { | 1245 if (IsLocalRoot()) { |
1246 // DevToolsAgent is a RenderFrameObserver, and will destruct itself | 1246 // DevToolsAgent is a RenderFrameObserver, and will destruct itself |
1247 // when |this| is deleted. | 1247 // when |this| is deleted. |
1248 devtools_agent_ = new DevToolsAgent(this); | 1248 devtools_agent_ = new DevToolsAgent(this); |
1249 } | 1249 } |
1250 | 1250 |
(...skipping 22 matching lines...) Expand all Loading... |
1273 blame_context_ = base::MakeUnique<FrameBlameContext>(this, parent_frame); | 1273 blame_context_ = base::MakeUnique<FrameBlameContext>(this, parent_frame); |
1274 blame_context_->Initialize(); | 1274 blame_context_->Initialize(); |
1275 } | 1275 } |
1276 | 1276 |
1277 RenderWidget* RenderFrameImpl::GetRenderWidget() { | 1277 RenderWidget* RenderFrameImpl::GetRenderWidget() { |
1278 RenderFrameImpl* local_root = | 1278 RenderFrameImpl* local_root = |
1279 RenderFrameImpl::FromWebFrame(frame_->localRoot()); | 1279 RenderFrameImpl::FromWebFrame(frame_->localRoot()); |
1280 return local_root->render_widget_.get(); | 1280 return local_root->render_widget_.get(); |
1281 } | 1281 } |
1282 | 1282 |
1283 #if defined(ENABLE_PLUGINS) | 1283 #if BUILDFLAG(ENABLE_PLUGINS) |
1284 void RenderFrameImpl::PepperPluginCreated(RendererPpapiHost* host) { | 1284 void RenderFrameImpl::PepperPluginCreated(RendererPpapiHost* host) { |
1285 for (auto& observer : observers_) | 1285 for (auto& observer : observers_) |
1286 observer.DidCreatePepperPlugin(host); | 1286 observer.DidCreatePepperPlugin(host); |
1287 } | 1287 } |
1288 | 1288 |
1289 void RenderFrameImpl::PepperDidChangeCursor( | 1289 void RenderFrameImpl::PepperDidChangeCursor( |
1290 PepperPluginInstanceImpl* instance, | 1290 PepperPluginInstanceImpl* instance, |
1291 const blink::WebCursorInfo& cursor) { | 1291 const blink::WebCursorInfo& cursor) { |
1292 // Update the cursor appearance immediately if the requesting plugin is the | 1292 // Update the cursor appearance immediately if the requesting plugin is the |
1293 // one which receives the last mouse event. Otherwise, the new cursor won't be | 1293 // one which receives the last mouse event. Otherwise, the new cursor won't be |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1428 void RenderFrameImpl::OnImeCommitText(const base::string16& text, | 1428 void RenderFrameImpl::OnImeCommitText(const base::string16& text, |
1429 const gfx::Range& replacement_range, | 1429 const gfx::Range& replacement_range, |
1430 int relative_cursor_pos) { | 1430 int relative_cursor_pos) { |
1431 HandlePepperImeCommit(text); | 1431 HandlePepperImeCommit(text); |
1432 } | 1432 } |
1433 | 1433 |
1434 void RenderFrameImpl::OnImeFinishComposingText(bool keep_selection) { | 1434 void RenderFrameImpl::OnImeFinishComposingText(bool keep_selection) { |
1435 const base::string16& text = pepper_composition_text_; | 1435 const base::string16& text = pepper_composition_text_; |
1436 HandlePepperImeCommit(text); | 1436 HandlePepperImeCommit(text); |
1437 } | 1437 } |
1438 #endif // defined(ENABLE_PLUGINS) | 1438 #endif // BUILDFLAG(ENABLE_PLUGINS) |
1439 | 1439 |
1440 MediaStreamDispatcher* RenderFrameImpl::GetMediaStreamDispatcher() { | 1440 MediaStreamDispatcher* RenderFrameImpl::GetMediaStreamDispatcher() { |
1441 if (!web_user_media_client_) | 1441 if (!web_user_media_client_) |
1442 InitializeUserMediaClient(); | 1442 InitializeUserMediaClient(); |
1443 return web_user_media_client_ | 1443 return web_user_media_client_ |
1444 ? web_user_media_client_->media_stream_dispatcher() | 1444 ? web_user_media_client_->media_stream_dispatcher() |
1445 : nullptr; | 1445 : nullptr; |
1446 } | 1446 } |
1447 | 1447 |
1448 void RenderFrameImpl::ScriptedPrint(bool user_initiated) { | 1448 void RenderFrameImpl::ScriptedPrint(bool user_initiated) { |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1492 bool handled = true; | 1492 bool handled = true; |
1493 IPC_BEGIN_MESSAGE_MAP(RenderFrameImpl, msg) | 1493 IPC_BEGIN_MESSAGE_MAP(RenderFrameImpl, msg) |
1494 IPC_MESSAGE_HANDLER(FrameMsg_Navigate, OnNavigate) | 1494 IPC_MESSAGE_HANDLER(FrameMsg_Navigate, OnNavigate) |
1495 IPC_MESSAGE_HANDLER(FrameMsg_BeforeUnload, OnBeforeUnload) | 1495 IPC_MESSAGE_HANDLER(FrameMsg_BeforeUnload, OnBeforeUnload) |
1496 IPC_MESSAGE_HANDLER(FrameMsg_SwapOut, OnSwapOut) | 1496 IPC_MESSAGE_HANDLER(FrameMsg_SwapOut, OnSwapOut) |
1497 IPC_MESSAGE_HANDLER(FrameMsg_Delete, OnDeleteFrame) | 1497 IPC_MESSAGE_HANDLER(FrameMsg_Delete, OnDeleteFrame) |
1498 IPC_MESSAGE_HANDLER(FrameMsg_Stop, OnStop) | 1498 IPC_MESSAGE_HANDLER(FrameMsg_Stop, OnStop) |
1499 IPC_MESSAGE_HANDLER(FrameMsg_ContextMenuClosed, OnContextMenuClosed) | 1499 IPC_MESSAGE_HANDLER(FrameMsg_ContextMenuClosed, OnContextMenuClosed) |
1500 IPC_MESSAGE_HANDLER(FrameMsg_CustomContextMenuAction, | 1500 IPC_MESSAGE_HANDLER(FrameMsg_CustomContextMenuAction, |
1501 OnCustomContextMenuAction) | 1501 OnCustomContextMenuAction) |
1502 #if defined(ENABLE_PLUGINS) | 1502 #if BUILDFLAG(ENABLE_PLUGINS) |
1503 IPC_MESSAGE_HANDLER(FrameMsg_SetPepperVolume, OnSetPepperVolume) | 1503 IPC_MESSAGE_HANDLER(FrameMsg_SetPepperVolume, OnSetPepperVolume) |
1504 #endif | 1504 #endif |
1505 IPC_MESSAGE_HANDLER(InputMsg_Undo, OnUndo) | 1505 IPC_MESSAGE_HANDLER(InputMsg_Undo, OnUndo) |
1506 IPC_MESSAGE_HANDLER(InputMsg_Redo, OnRedo) | 1506 IPC_MESSAGE_HANDLER(InputMsg_Redo, OnRedo) |
1507 IPC_MESSAGE_HANDLER(InputMsg_Cut, OnCut) | 1507 IPC_MESSAGE_HANDLER(InputMsg_Cut, OnCut) |
1508 IPC_MESSAGE_HANDLER(InputMsg_Copy, OnCopy) | 1508 IPC_MESSAGE_HANDLER(InputMsg_Copy, OnCopy) |
1509 IPC_MESSAGE_HANDLER(InputMsg_Paste, OnPaste) | 1509 IPC_MESSAGE_HANDLER(InputMsg_Paste, OnPaste) |
1510 IPC_MESSAGE_HANDLER(InputMsg_PasteAndMatchStyle, OnPasteAndMatchStyle) | 1510 IPC_MESSAGE_HANDLER(InputMsg_PasteAndMatchStyle, OnPasteAndMatchStyle) |
1511 IPC_MESSAGE_HANDLER(InputMsg_Delete, OnDelete) | 1511 IPC_MESSAGE_HANDLER(InputMsg_Delete, OnDelete) |
1512 IPC_MESSAGE_HANDLER(InputMsg_SelectAll, OnSelectAll) | 1512 IPC_MESSAGE_HANDLER(InputMsg_SelectAll, OnSelectAll) |
(...skipping 869 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2382 } | 2382 } |
2383 | 2383 |
2384 void RenderFrameImpl::DidCommitCompositorFrame() { | 2384 void RenderFrameImpl::DidCommitCompositorFrame() { |
2385 if (BrowserPluginManager::Get()) | 2385 if (BrowserPluginManager::Get()) |
2386 BrowserPluginManager::Get()->DidCommitCompositorFrame(GetRoutingID()); | 2386 BrowserPluginManager::Get()->DidCommitCompositorFrame(GetRoutingID()); |
2387 for (auto& observer : observers_) | 2387 for (auto& observer : observers_) |
2388 observer.DidCommitCompositorFrame(); | 2388 observer.DidCommitCompositorFrame(); |
2389 } | 2389 } |
2390 | 2390 |
2391 void RenderFrameImpl::DidCommitAndDrawCompositorFrame() { | 2391 void RenderFrameImpl::DidCommitAndDrawCompositorFrame() { |
2392 #if defined(ENABLE_PLUGINS) | 2392 #if BUILDFLAG(ENABLE_PLUGINS) |
2393 // Notify all instances that we painted. The same caveats apply as for | 2393 // Notify all instances that we painted. The same caveats apply as for |
2394 // ViewFlushedPaint regarding instances closing themselves, so we take | 2394 // ViewFlushedPaint regarding instances closing themselves, so we take |
2395 // similar precautions. | 2395 // similar precautions. |
2396 PepperPluginSet plugins = active_pepper_instances_; | 2396 PepperPluginSet plugins = active_pepper_instances_; |
2397 for (auto* plugin : plugins) { | 2397 for (auto* plugin : plugins) { |
2398 if (active_pepper_instances_.find(plugin) != active_pepper_instances_.end()) | 2398 if (active_pepper_instances_.find(plugin) != active_pepper_instances_.end()) |
2399 plugin->ViewInitiatedPaint(); | 2399 plugin->ViewInitiatedPaint(); |
2400 } | 2400 } |
2401 #endif | 2401 #endif |
2402 } | 2402 } |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2441 DCHECK(pending_context_menus_.Lookup(request_id)); | 2441 DCHECK(pending_context_menus_.Lookup(request_id)); |
2442 pending_context_menus_.Remove(request_id); | 2442 pending_context_menus_.Remove(request_id); |
2443 } | 2443 } |
2444 | 2444 |
2445 blink::WebPlugin* RenderFrameImpl::CreatePlugin( | 2445 blink::WebPlugin* RenderFrameImpl::CreatePlugin( |
2446 blink::WebFrame* frame, | 2446 blink::WebFrame* frame, |
2447 const WebPluginInfo& info, | 2447 const WebPluginInfo& info, |
2448 const blink::WebPluginParams& params, | 2448 const blink::WebPluginParams& params, |
2449 std::unique_ptr<content::PluginInstanceThrottler> throttler) { | 2449 std::unique_ptr<content::PluginInstanceThrottler> throttler) { |
2450 DCHECK_EQ(frame_, frame); | 2450 DCHECK_EQ(frame_, frame); |
2451 #if defined(ENABLE_PLUGINS) | 2451 #if BUILDFLAG(ENABLE_PLUGINS) |
2452 if (info.type == WebPluginInfo::PLUGIN_TYPE_BROWSER_PLUGIN) { | 2452 if (info.type == WebPluginInfo::PLUGIN_TYPE_BROWSER_PLUGIN) { |
2453 return BrowserPluginManager::Get()->CreateBrowserPlugin( | 2453 return BrowserPluginManager::Get()->CreateBrowserPlugin( |
2454 this, GetContentClient() | 2454 this, GetContentClient() |
2455 ->renderer() | 2455 ->renderer() |
2456 ->CreateBrowserPluginDelegate(this, params.mimeType.utf8(), | 2456 ->CreateBrowserPluginDelegate(this, params.mimeType.utf8(), |
2457 GURL(params.url)) | 2457 GURL(params.url)) |
2458 ->GetWeakPtr()); | 2458 ->GetWeakPtr()); |
2459 } | 2459 } |
2460 | 2460 |
2461 bool pepper_plugin_was_registered = false; | 2461 bool pepper_plugin_was_registered = false; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2512 } else { | 2512 } else { |
2513 // In some tests the thread may be null, | 2513 // In some tests the thread may be null, |
2514 // so set up a self-contained interface provider instead. | 2514 // so set up a self-contained interface provider instead. |
2515 remote_associated_interfaces_.reset( | 2515 remote_associated_interfaces_.reset( |
2516 new AssociatedInterfaceProviderImpl()); | 2516 new AssociatedInterfaceProviderImpl()); |
2517 } | 2517 } |
2518 } | 2518 } |
2519 return remote_associated_interfaces_.get(); | 2519 return remote_associated_interfaces_.get(); |
2520 } | 2520 } |
2521 | 2521 |
2522 #if defined(ENABLE_PLUGINS) | 2522 #if BUILDFLAG(ENABLE_PLUGINS) |
2523 void RenderFrameImpl::RegisterPeripheralPlugin( | 2523 void RenderFrameImpl::RegisterPeripheralPlugin( |
2524 const url::Origin& content_origin, | 2524 const url::Origin& content_origin, |
2525 const base::Closure& unthrottle_callback) { | 2525 const base::Closure& unthrottle_callback) { |
2526 return plugin_power_saver_helper_->RegisterPeripheralPlugin( | 2526 return plugin_power_saver_helper_->RegisterPeripheralPlugin( |
2527 content_origin, unthrottle_callback); | 2527 content_origin, unthrottle_callback); |
2528 } | 2528 } |
2529 | 2529 |
2530 RenderFrame::PeripheralContentStatus | 2530 RenderFrame::PeripheralContentStatus |
2531 RenderFrameImpl::GetPeripheralContentStatus( | 2531 RenderFrameImpl::GetPeripheralContentStatus( |
2532 const url::Origin& main_frame_origin, | 2532 const url::Origin& main_frame_origin, |
2533 const url::Origin& content_origin, | 2533 const url::Origin& content_origin, |
2534 const gfx::Size& unobscured_size, | 2534 const gfx::Size& unobscured_size, |
2535 RecordPeripheralDecision record_decision) const { | 2535 RecordPeripheralDecision record_decision) const { |
2536 return plugin_power_saver_helper_->GetPeripheralContentStatus( | 2536 return plugin_power_saver_helper_->GetPeripheralContentStatus( |
2537 main_frame_origin, content_origin, unobscured_size, record_decision); | 2537 main_frame_origin, content_origin, unobscured_size, record_decision); |
2538 } | 2538 } |
2539 | 2539 |
2540 void RenderFrameImpl::WhitelistContentOrigin( | 2540 void RenderFrameImpl::WhitelistContentOrigin( |
2541 const url::Origin& content_origin) { | 2541 const url::Origin& content_origin) { |
2542 return plugin_power_saver_helper_->WhitelistContentOrigin(content_origin); | 2542 return plugin_power_saver_helper_->WhitelistContentOrigin(content_origin); |
2543 } | 2543 } |
2544 | 2544 |
2545 void RenderFrameImpl::DidStartLoading() { | 2545 void RenderFrameImpl::DidStartLoading() { |
2546 didStartLoading(true); | 2546 didStartLoading(true); |
2547 } | 2547 } |
2548 | 2548 |
2549 void RenderFrameImpl::DidStopLoading() { | 2549 void RenderFrameImpl::DidStopLoading() { |
2550 didStopLoading(); | 2550 didStopLoading(); |
2551 } | 2551 } |
2552 #endif // defined(ENABLE_PLUGINS) | 2552 #endif // BUILDFLAG(ENABLE_PLUGINS) |
2553 | 2553 |
2554 bool RenderFrameImpl::IsFTPDirectoryListing() { | 2554 bool RenderFrameImpl::IsFTPDirectoryListing() { |
2555 WebURLResponseExtraDataImpl* extra_data = | 2555 WebURLResponseExtraDataImpl* extra_data = |
2556 GetExtraDataFromResponse(frame_->dataSource()->response()); | 2556 GetExtraDataFromResponse(frame_->dataSource()->response()); |
2557 return extra_data ? extra_data->is_ftp_directory_listing() : false; | 2557 return extra_data ? extra_data->is_ftp_directory_listing() : false; |
2558 } | 2558 } |
2559 | 2559 |
2560 void RenderFrameImpl::AttachGuest(int element_instance_id) { | 2560 void RenderFrameImpl::AttachGuest(int element_instance_id) { |
2561 BrowserPluginManager::Get()->Attach(element_instance_id); | 2561 BrowserPluginManager::Get()->Attach(element_instance_id); |
2562 } | 2562 } |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2679 if (base::UTF16ToUTF8(base::StringPiece16(params.mimeType)) == | 2679 if (base::UTF16ToUTF8(base::StringPiece16(params.mimeType)) == |
2680 kBrowserPluginMimeType) { | 2680 kBrowserPluginMimeType) { |
2681 return BrowserPluginManager::Get()->CreateBrowserPlugin( | 2681 return BrowserPluginManager::Get()->CreateBrowserPlugin( |
2682 this, GetContentClient() | 2682 this, GetContentClient() |
2683 ->renderer() | 2683 ->renderer() |
2684 ->CreateBrowserPluginDelegate(this, kBrowserPluginMimeType, | 2684 ->CreateBrowserPluginDelegate(this, kBrowserPluginMimeType, |
2685 GURL(params.url)) | 2685 GURL(params.url)) |
2686 ->GetWeakPtr()); | 2686 ->GetWeakPtr()); |
2687 } | 2687 } |
2688 | 2688 |
2689 #if defined(ENABLE_PLUGINS) | 2689 #if BUILDFLAG(ENABLE_PLUGINS) |
2690 WebPluginInfo info; | 2690 WebPluginInfo info; |
2691 std::string mime_type; | 2691 std::string mime_type; |
2692 bool found = false; | 2692 bool found = false; |
2693 Send(new FrameHostMsg_GetPluginInfo( | 2693 Send(new FrameHostMsg_GetPluginInfo( |
2694 routing_id_, params.url, frame->top()->getSecurityOrigin(), | 2694 routing_id_, params.url, frame->top()->getSecurityOrigin(), |
2695 params.mimeType.utf8(), &found, &info, &mime_type)); | 2695 params.mimeType.utf8(), &found, &info, &mime_type)); |
2696 if (!found) | 2696 if (!found) |
2697 return NULL; | 2697 return NULL; |
2698 | 2698 |
2699 WebPluginParams params_to_use = params; | 2699 WebPluginParams params_to_use = params; |
2700 params_to_use.mimeType = WebString::fromUTF8(mime_type); | 2700 params_to_use.mimeType = WebString::fromUTF8(mime_type); |
2701 return CreatePlugin(frame, info, params_to_use, nullptr /* throttler */); | 2701 return CreatePlugin(frame, info, params_to_use, nullptr /* throttler */); |
2702 #else | 2702 #else |
2703 return NULL; | 2703 return NULL; |
2704 #endif // defined(ENABLE_PLUGINS) | 2704 #endif // BUILDFLAG(ENABLE_PLUGINS) |
2705 } | 2705 } |
2706 | 2706 |
2707 #if BUILDFLAG(ENABLE_MEDIA_REMOTING) | 2707 #if BUILDFLAG(ENABLE_MEDIA_REMOTING) |
2708 std::unique_ptr<media::RemotingRendererController> | 2708 std::unique_ptr<media::RemotingRendererController> |
2709 RenderFrameImpl::CreateRemotingRendererController() { | 2709 RenderFrameImpl::CreateRemotingRendererController() { |
2710 media::mojom::RemotingSourcePtr remoting_source; | 2710 media::mojom::RemotingSourcePtr remoting_source; |
2711 media::mojom::RemotingSourceRequest remoting_source_request = | 2711 media::mojom::RemotingSourceRequest remoting_source_request = |
2712 mojo::GetProxy(&remoting_source); | 2712 mojo::GetProxy(&remoting_source); |
2713 media::mojom::RemoterPtr remoter; | 2713 media::mojom::RemoterPtr remoter; |
2714 GetRemoterFactory()->Create(std::move(remoting_source), | 2714 GetRemoterFactory()->Create(std::move(remoting_source), |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3003 Send(new FrameHostMsg_DidChangeOpener(routing_id_, opener_routing_id)); | 3003 Send(new FrameHostMsg_DidChangeOpener(routing_id_, opener_routing_id)); |
3004 } | 3004 } |
3005 | 3005 |
3006 void RenderFrameImpl::frameDetached(blink::WebLocalFrame* frame, | 3006 void RenderFrameImpl::frameDetached(blink::WebLocalFrame* frame, |
3007 DetachType type) { | 3007 DetachType type) { |
3008 // NOTE: This function is called on the frame that is being detached and not | 3008 // NOTE: This function is called on the frame that is being detached and not |
3009 // the parent frame. This is different from createChildFrame() which is | 3009 // the parent frame. This is different from createChildFrame() which is |
3010 // called on the parent frame. | 3010 // called on the parent frame. |
3011 DCHECK_EQ(frame_, frame); | 3011 DCHECK_EQ(frame_, frame); |
3012 | 3012 |
3013 #if defined(ENABLE_PLUGINS) | 3013 #if BUILDFLAG(ENABLE_PLUGINS) |
3014 if (focused_pepper_plugin_) | 3014 if (focused_pepper_plugin_) |
3015 GetRenderWidget()->set_focused_pepper_plugin(nullptr); | 3015 GetRenderWidget()->set_focused_pepper_plugin(nullptr); |
3016 #endif | 3016 #endif |
3017 | 3017 |
3018 for (auto& observer : observers_) | 3018 for (auto& observer : observers_) |
3019 observer.FrameDetached(); | 3019 observer.FrameDetached(); |
3020 for (auto& observer : render_view_->observers()) | 3020 for (auto& observer : render_view_->observers()) |
3021 observer.FrameDetached(frame); | 3021 observer.FrameDetached(frame); |
3022 | 3022 |
3023 // Send a state update before the frame is detached. | 3023 // Send a state update before the frame is detached. |
(...skipping 1614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4638 } | 4638 } |
4639 | 4639 |
4640 for (auto& observer : observers_) | 4640 for (auto& observer : observers_) |
4641 observer.OnStop(); | 4641 observer.OnStop(); |
4642 } | 4642 } |
4643 | 4643 |
4644 void RenderFrameImpl::WasHidden() { | 4644 void RenderFrameImpl::WasHidden() { |
4645 for (auto& observer : observers_) | 4645 for (auto& observer : observers_) |
4646 observer.WasHidden(); | 4646 observer.WasHidden(); |
4647 | 4647 |
4648 #if defined(ENABLE_PLUGINS) | 4648 #if BUILDFLAG(ENABLE_PLUGINS) |
4649 for (auto* plugin : active_pepper_instances_) | 4649 for (auto* plugin : active_pepper_instances_) |
4650 plugin->PageVisibilityChanged(false); | 4650 plugin->PageVisibilityChanged(false); |
4651 #endif // ENABLE_PLUGINS | 4651 #endif // ENABLE_PLUGINS |
4652 | 4652 |
4653 if (GetWebFrame()->frameWidget()) { | 4653 if (GetWebFrame()->frameWidget()) { |
4654 GetWebFrame()->frameWidget()->setVisibilityState(visibilityState()); | 4654 GetWebFrame()->frameWidget()->setVisibilityState(visibilityState()); |
4655 } | 4655 } |
4656 } | 4656 } |
4657 | 4657 |
4658 void RenderFrameImpl::WasShown() { | 4658 void RenderFrameImpl::WasShown() { |
4659 for (auto& observer : observers_) | 4659 for (auto& observer : observers_) |
4660 observer.WasShown(); | 4660 observer.WasShown(); |
4661 | 4661 |
4662 #if defined(ENABLE_PLUGINS) | 4662 #if BUILDFLAG(ENABLE_PLUGINS) |
4663 for (auto* plugin : active_pepper_instances_) | 4663 for (auto* plugin : active_pepper_instances_) |
4664 plugin->PageVisibilityChanged(true); | 4664 plugin->PageVisibilityChanged(true); |
4665 #endif // ENABLE_PLUGINS | 4665 #endif // ENABLE_PLUGINS |
4666 | 4666 |
4667 if (GetWebFrame()->frameWidget()) { | 4667 if (GetWebFrame()->frameWidget()) { |
4668 GetWebFrame()->frameWidget()->setVisibilityState(visibilityState()); | 4668 GetWebFrame()->frameWidget()->setVisibilityState(visibilityState()); |
4669 } | 4669 } |
4670 } | 4670 } |
4671 | 4671 |
4672 void RenderFrameImpl::WidgetWillClose() { | 4672 void RenderFrameImpl::WidgetWillClose() { |
(...skipping 1229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5902 const std::string& encoding_name) { | 5902 const std::string& encoding_name) { |
5903 // Only update main frame's encoding_name. | 5903 // Only update main frame's encoding_name. |
5904 if (!frame->parent()) | 5904 if (!frame->parent()) |
5905 Send(new FrameHostMsg_UpdateEncoding(routing_id_, encoding_name)); | 5905 Send(new FrameHostMsg_UpdateEncoding(routing_id_, encoding_name)); |
5906 } | 5906 } |
5907 | 5907 |
5908 void RenderFrameImpl::SyncSelectionIfRequired() { | 5908 void RenderFrameImpl::SyncSelectionIfRequired() { |
5909 base::string16 text; | 5909 base::string16 text; |
5910 size_t offset; | 5910 size_t offset; |
5911 gfx::Range range; | 5911 gfx::Range range; |
5912 #if defined(ENABLE_PLUGINS) | 5912 #if BUILDFLAG(ENABLE_PLUGINS) |
5913 if (focused_pepper_plugin_) { | 5913 if (focused_pepper_plugin_) { |
5914 focused_pepper_plugin_->GetSurroundingText(&text, &range); | 5914 focused_pepper_plugin_->GetSurroundingText(&text, &range); |
5915 offset = 0; // Pepper API does not support offset reporting. | 5915 offset = 0; // Pepper API does not support offset reporting. |
5916 // TODO(kinaba): cut as needed. | 5916 // TODO(kinaba): cut as needed. |
5917 } else | 5917 } else |
5918 #endif | 5918 #endif |
5919 { | 5919 { |
5920 WebRange selection = | 5920 WebRange selection = |
5921 GetRenderWidget()->GetWebWidget()->caretOrSelectionRange(); | 5921 GetRenderWidget()->GetWebWidget()->caretOrSelectionRange(); |
5922 if (selection.isNull()) | 5922 if (selection.isNull()) |
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6410 media::DecoderFactory* RenderFrameImpl::GetDecoderFactory() { | 6410 media::DecoderFactory* RenderFrameImpl::GetDecoderFactory() { |
6411 #if defined(ENABLE_MOJO_AUDIO_DECODER) || defined(ENABLE_MOJO_VIDEO_DECODER) | 6411 #if defined(ENABLE_MOJO_AUDIO_DECODER) || defined(ENABLE_MOJO_VIDEO_DECODER) |
6412 if (!decoder_factory_) { | 6412 if (!decoder_factory_) { |
6413 decoder_factory_.reset( | 6413 decoder_factory_.reset( |
6414 new media::MojoDecoderFactory(GetMediaInterfaceProvider())); | 6414 new media::MojoDecoderFactory(GetMediaInterfaceProvider())); |
6415 } | 6415 } |
6416 #endif | 6416 #endif |
6417 return decoder_factory_.get(); | 6417 return decoder_factory_.get(); |
6418 } | 6418 } |
6419 | 6419 |
6420 #if defined(ENABLE_PLUGINS) | 6420 #if BUILDFLAG(ENABLE_PLUGINS) |
6421 void RenderFrameImpl::HandlePepperImeCommit(const base::string16& text) { | 6421 void RenderFrameImpl::HandlePepperImeCommit(const base::string16& text) { |
6422 if (text.empty()) | 6422 if (text.empty()) |
6423 return; | 6423 return; |
6424 | 6424 |
6425 if (!IsPepperAcceptingCompositionEvents()) { | 6425 if (!IsPepperAcceptingCompositionEvents()) { |
6426 // For pepper plugins unable to handle IME events, send the plugin a | 6426 // For pepper plugins unable to handle IME events, send the plugin a |
6427 // sequence of characters instead. | 6427 // sequence of characters instead. |
6428 base::i18n::UTF16CharIterator iterator(&text); | 6428 base::i18n::UTF16CharIterator iterator(&text); |
6429 int32_t i = 0; | 6429 int32_t i = 0; |
6430 while (iterator.Advance()) { | 6430 while (iterator.Advance()) { |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6522 } | 6522 } |
6523 | 6523 |
6524 bool RenderFrameImpl::IsBrowserSideNavigationPending() { | 6524 bool RenderFrameImpl::IsBrowserSideNavigationPending() { |
6525 return browser_side_navigation_pending_; | 6525 return browser_side_navigation_pending_; |
6526 } | 6526 } |
6527 | 6527 |
6528 blink::WebPlugin* RenderFrameImpl::GetWebPluginForFind() { | 6528 blink::WebPlugin* RenderFrameImpl::GetWebPluginForFind() { |
6529 if (frame_->document().isPluginDocument()) | 6529 if (frame_->document().isPluginDocument()) |
6530 return frame_->document().to<WebPluginDocument>().plugin(); | 6530 return frame_->document().to<WebPluginDocument>().plugin(); |
6531 | 6531 |
6532 #if defined(ENABLE_PLUGINS) | 6532 #if BUILDFLAG(ENABLE_PLUGINS) |
6533 if (plugin_find_handler_) | 6533 if (plugin_find_handler_) |
6534 return plugin_find_handler_->container()->plugin(); | 6534 return plugin_find_handler_->container()->plugin(); |
6535 #endif | 6535 #endif |
6536 | 6536 |
6537 return nullptr; | 6537 return nullptr; |
6538 } | 6538 } |
6539 | 6539 |
6540 void RenderFrameImpl::SendFindReply(int request_id, | 6540 void RenderFrameImpl::SendFindReply(int request_id, |
6541 int match_count, | 6541 int match_count, |
6542 int ordinal, | 6542 int ordinal, |
6543 const WebRect& selection_rect, | 6543 const WebRect& selection_rect, |
6544 bool final_status_update) { | 6544 bool final_status_update) { |
6545 if (final_status_update && !ordinal) | 6545 if (final_status_update && !ordinal) |
6546 frame_->executeCommand(WebString::fromUTF8("Unselect")); | 6546 frame_->executeCommand(WebString::fromUTF8("Unselect")); |
6547 DCHECK(ordinal >= -1); | 6547 DCHECK(ordinal >= -1); |
6548 | 6548 |
6549 Send(new FrameHostMsg_Find_Reply(routing_id_, | 6549 Send(new FrameHostMsg_Find_Reply(routing_id_, |
6550 request_id, | 6550 request_id, |
6551 match_count, | 6551 match_count, |
6552 selection_rect, | 6552 selection_rect, |
6553 ordinal, | 6553 ordinal, |
6554 final_status_update)); | 6554 final_status_update)); |
6555 } | 6555 } |
6556 | 6556 |
6557 #if defined(ENABLE_PLUGINS) | 6557 #if BUILDFLAG(ENABLE_PLUGINS) |
6558 void RenderFrameImpl::PepperInstanceCreated( | 6558 void RenderFrameImpl::PepperInstanceCreated( |
6559 PepperPluginInstanceImpl* instance) { | 6559 PepperPluginInstanceImpl* instance) { |
6560 active_pepper_instances_.insert(instance); | 6560 active_pepper_instances_.insert(instance); |
6561 | 6561 |
6562 Send(new FrameHostMsg_PepperInstanceCreated( | 6562 Send(new FrameHostMsg_PepperInstanceCreated( |
6563 routing_id_, instance->pp_instance())); | 6563 routing_id_, instance->pp_instance())); |
6564 } | 6564 } |
6565 | 6565 |
6566 void RenderFrameImpl::PepperInstanceDeleted( | 6566 void RenderFrameImpl::PepperInstanceDeleted( |
6567 PepperPluginInstanceImpl* instance) { | 6567 PepperPluginInstanceImpl* instance) { |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6617 | 6617 |
6618 void RenderFrameImpl::OnSetPepperVolume(int32_t pp_instance, double volume) { | 6618 void RenderFrameImpl::OnSetPepperVolume(int32_t pp_instance, double volume) { |
6619 PepperPluginInstanceImpl* instance = static_cast<PepperPluginInstanceImpl*>( | 6619 PepperPluginInstanceImpl* instance = static_cast<PepperPluginInstanceImpl*>( |
6620 PepperPluginInstance::Get(pp_instance)); | 6620 PepperPluginInstance::Get(pp_instance)); |
6621 if (instance) | 6621 if (instance) |
6622 instance->audio_controller().SetVolume(volume); | 6622 instance->audio_controller().SetVolume(volume); |
6623 } | 6623 } |
6624 #endif // ENABLE_PLUGINS | 6624 #endif // ENABLE_PLUGINS |
6625 | 6625 |
6626 void RenderFrameImpl::RenderWidgetSetFocus(bool enable) { | 6626 void RenderFrameImpl::RenderWidgetSetFocus(bool enable) { |
6627 #if defined(ENABLE_PLUGINS) | 6627 #if BUILDFLAG(ENABLE_PLUGINS) |
6628 // Notify all Pepper plugins. | 6628 // Notify all Pepper plugins. |
6629 for (auto* plugin : active_pepper_instances_) | 6629 for (auto* plugin : active_pepper_instances_) |
6630 plugin->SetContentAreaFocus(enable); | 6630 plugin->SetContentAreaFocus(enable); |
6631 #endif | 6631 #endif |
6632 } | 6632 } |
6633 | 6633 |
6634 void RenderFrameImpl::RenderWidgetWillHandleMouseEvent() { | 6634 void RenderFrameImpl::RenderWidgetWillHandleMouseEvent() { |
6635 #if defined(ENABLE_PLUGINS) | 6635 #if BUILDFLAG(ENABLE_PLUGINS) |
6636 // This method is called for every mouse event that the RenderWidget receives. | 6636 // This method is called for every mouse event that the RenderWidget receives. |
6637 // And then the mouse event is forwarded to blink, which dispatches it to the | 6637 // And then the mouse event is forwarded to blink, which dispatches it to the |
6638 // event target. Potentially a Pepper plugin will receive the event. | 6638 // event target. Potentially a Pepper plugin will receive the event. |
6639 // In order to tell whether a plugin gets the last mouse event and which it | 6639 // In order to tell whether a plugin gets the last mouse event and which it |
6640 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets | 6640 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets |
6641 // the event, it will notify us via DidReceiveMouseEvent() and set itself as | 6641 // the event, it will notify us via DidReceiveMouseEvent() and set itself as |
6642 // |pepper_last_mouse_event_target_|. | 6642 // |pepper_last_mouse_event_target_|. |
6643 pepper_last_mouse_event_target_ = nullptr; | 6643 pepper_last_mouse_event_target_ = nullptr; |
6644 #endif | 6644 #endif |
6645 } | 6645 } |
6646 | 6646 |
6647 } // namespace content | 6647 } // namespace content |
OLD | NEW |