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 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 | 222 |
223 #include "content/renderer/android/app_web_message_port_client.h" | 223 #include "content/renderer/android/app_web_message_port_client.h" |
224 #include "content/renderer/java/gin_java_bridge_dispatcher.h" | 224 #include "content/renderer/java/gin_java_bridge_dispatcher.h" |
225 #include "content/renderer/media/android/media_player_renderer_client_factory.h" | 225 #include "content/renderer/media/android/media_player_renderer_client_factory.h" |
226 #include "content/renderer/media/android/renderer_media_player_manager.h" | 226 #include "content/renderer/media/android/renderer_media_player_manager.h" |
227 #include "content/renderer/media/android/renderer_surface_view_manager.h" | 227 #include "content/renderer/media/android/renderer_surface_view_manager.h" |
228 #include "content/renderer/media/android/stream_texture_factory.h" | 228 #include "content/renderer/media/android/stream_texture_factory.h" |
229 #include "content/renderer/media/android/stream_texture_wrapper_impl.h" | 229 #include "content/renderer/media/android/stream_texture_wrapper_impl.h" |
230 #include "content/renderer/media/android/webmediaplayer_android.h" | 230 #include "content/renderer/media/android/webmediaplayer_android.h" |
231 #include "media/base/android/media_codec_util.h" | 231 #include "media/base/android/media_codec_util.h" |
232 #include "media/mojo/clients/mojo_renderer_factory.h" // nogncheck | |
233 #include "third_party/WebKit/public/platform/WebFloatPoint.h" | 232 #include "third_party/WebKit/public/platform/WebFloatPoint.h" |
234 #endif | 233 #endif |
235 | 234 |
236 #if BUILDFLAG(ENABLE_PEPPER_CDMS) | 235 #if BUILDFLAG(ENABLE_PEPPER_CDMS) |
237 #include "content/renderer/media/cdm/pepper_cdm_wrapper_impl.h" | 236 #include "content/renderer/media/cdm/pepper_cdm_wrapper_impl.h" |
238 #include "content/renderer/media/cdm/render_cdm_factory.h" | 237 #include "content/renderer/media/cdm/render_cdm_factory.h" |
239 #endif | 238 #endif |
240 | 239 |
241 #if defined(ENABLE_MOJO_MEDIA) | 240 #if defined(ENABLE_MOJO_MEDIA) |
242 #include "content/renderer/media/media_interface_provider.h" | 241 #include "content/renderer/media/media_interface_provider.h" |
(...skipping 1224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1467 focused_pepper_plugin_->HandleCompositionEnd(text); | 1466 focused_pepper_plugin_->HandleCompositionEnd(text); |
1468 focused_pepper_plugin_->HandleTextInput(text); | 1467 focused_pepper_plugin_->HandleTextInput(text); |
1469 } | 1468 } |
1470 pepper_composition_text_.clear(); | 1469 pepper_composition_text_.clear(); |
1471 } | 1470 } |
1472 #endif // defined(ENABLE_PLUGINS) | 1471 #endif // defined(ENABLE_PLUGINS) |
1473 | 1472 |
1474 MediaStreamDispatcher* RenderFrameImpl::GetMediaStreamDispatcher() { | 1473 MediaStreamDispatcher* RenderFrameImpl::GetMediaStreamDispatcher() { |
1475 if (!web_user_media_client_) | 1474 if (!web_user_media_client_) |
1476 InitializeUserMediaClient(); | 1475 InitializeUserMediaClient(); |
1477 return web_user_media_client_ ? | 1476 return web_user_media_client_ |
1478 web_user_media_client_->media_stream_dispatcher() : NULL; | 1477 ? web_user_media_client_->media_stream_dispatcher() |
| 1478 : nullptr; |
| 1479 } |
| 1480 |
| 1481 void RenderFrameImpl::ScriptedPrint(bool user_initiated) { |
| 1482 for (auto& observer : observers_) |
| 1483 observer.ScriptedPrint(user_initiated); |
1479 } | 1484 } |
1480 | 1485 |
1481 bool RenderFrameImpl::Send(IPC::Message* message) { | 1486 bool RenderFrameImpl::Send(IPC::Message* message) { |
1482 return RenderThread::Get()->Send(message); | 1487 return RenderThread::Get()->Send(message); |
1483 } | 1488 } |
1484 | 1489 |
1485 #if defined(USE_EXTERNAL_POPUP_MENU) | 1490 #if defined(USE_EXTERNAL_POPUP_MENU) |
1486 void RenderFrameImpl::DidHideExternalPopupMenu() { | 1491 void RenderFrameImpl::DidHideExternalPopupMenu() { |
1487 // We need to clear external_popup_menu_ as soon as ExternalPopupMenu::close | 1492 // We need to clear external_popup_menu_ as soon as ExternalPopupMenu::close |
1488 // is called. Otherwise, createExternalPopupMenu() for new popup will fail. | 1493 // is called. Otherwise, createExternalPopupMenu() for new popup will fail. |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1522 IPC_MESSAGE_HANDLER(FrameMsg_Navigate, OnNavigate) | 1527 IPC_MESSAGE_HANDLER(FrameMsg_Navigate, OnNavigate) |
1523 IPC_MESSAGE_HANDLER(FrameMsg_BeforeUnload, OnBeforeUnload) | 1528 IPC_MESSAGE_HANDLER(FrameMsg_BeforeUnload, OnBeforeUnload) |
1524 IPC_MESSAGE_HANDLER(FrameMsg_SwapOut, OnSwapOut) | 1529 IPC_MESSAGE_HANDLER(FrameMsg_SwapOut, OnSwapOut) |
1525 IPC_MESSAGE_HANDLER(FrameMsg_Delete, OnDeleteFrame) | 1530 IPC_MESSAGE_HANDLER(FrameMsg_Delete, OnDeleteFrame) |
1526 IPC_MESSAGE_HANDLER(FrameMsg_Stop, OnStop) | 1531 IPC_MESSAGE_HANDLER(FrameMsg_Stop, OnStop) |
1527 IPC_MESSAGE_HANDLER(FrameMsg_ContextMenuClosed, OnContextMenuClosed) | 1532 IPC_MESSAGE_HANDLER(FrameMsg_ContextMenuClosed, OnContextMenuClosed) |
1528 IPC_MESSAGE_HANDLER(FrameMsg_CustomContextMenuAction, | 1533 IPC_MESSAGE_HANDLER(FrameMsg_CustomContextMenuAction, |
1529 OnCustomContextMenuAction) | 1534 OnCustomContextMenuAction) |
1530 #if defined(ENABLE_PLUGINS) | 1535 #if defined(ENABLE_PLUGINS) |
1531 IPC_MESSAGE_HANDLER(FrameMsg_SetPepperVolume, OnSetPepperVolume) | 1536 IPC_MESSAGE_HANDLER(FrameMsg_SetPepperVolume, OnSetPepperVolume) |
1532 #endif //defined(ENABLE_PLUGINS) | 1537 #endif |
1533 IPC_MESSAGE_HANDLER(InputMsg_Undo, OnUndo) | 1538 IPC_MESSAGE_HANDLER(InputMsg_Undo, OnUndo) |
1534 IPC_MESSAGE_HANDLER(InputMsg_Redo, OnRedo) | 1539 IPC_MESSAGE_HANDLER(InputMsg_Redo, OnRedo) |
1535 IPC_MESSAGE_HANDLER(InputMsg_Cut, OnCut) | 1540 IPC_MESSAGE_HANDLER(InputMsg_Cut, OnCut) |
1536 IPC_MESSAGE_HANDLER(InputMsg_Copy, OnCopy) | 1541 IPC_MESSAGE_HANDLER(InputMsg_Copy, OnCopy) |
1537 IPC_MESSAGE_HANDLER(InputMsg_Paste, OnPaste) | 1542 IPC_MESSAGE_HANDLER(InputMsg_Paste, OnPaste) |
1538 IPC_MESSAGE_HANDLER(InputMsg_PasteAndMatchStyle, OnPasteAndMatchStyle) | 1543 IPC_MESSAGE_HANDLER(InputMsg_PasteAndMatchStyle, OnPasteAndMatchStyle) |
1539 IPC_MESSAGE_HANDLER(InputMsg_Delete, OnDelete) | 1544 IPC_MESSAGE_HANDLER(InputMsg_Delete, OnDelete) |
1540 IPC_MESSAGE_HANDLER(InputMsg_SelectAll, OnSelectAll) | 1545 IPC_MESSAGE_HANDLER(InputMsg_SelectAll, OnSelectAll) |
1541 IPC_MESSAGE_HANDLER(InputMsg_SelectRange, OnSelectRange) | 1546 IPC_MESSAGE_HANDLER(InputMsg_SelectRange, OnSelectRange) |
1542 IPC_MESSAGE_HANDLER(InputMsg_AdjustSelectionByCharacterOffset, | 1547 IPC_MESSAGE_HANDLER(InputMsg_AdjustSelectionByCharacterOffset, |
(...skipping 1016 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2559 BrowserPluginManager::Get()->Attach(element_instance_id); | 2564 BrowserPluginManager::Get()->Attach(element_instance_id); |
2560 } | 2565 } |
2561 | 2566 |
2562 void RenderFrameImpl::DetachGuest(int element_instance_id) { | 2567 void RenderFrameImpl::DetachGuest(int element_instance_id) { |
2563 BrowserPluginManager::Get()->Detach(element_instance_id); | 2568 BrowserPluginManager::Get()->Detach(element_instance_id); |
2564 } | 2569 } |
2565 | 2570 |
2566 void RenderFrameImpl::SetSelectedText(const base::string16& selection_text, | 2571 void RenderFrameImpl::SetSelectedText(const base::string16& selection_text, |
2567 size_t offset, | 2572 size_t offset, |
2568 const gfx::Range& range) { | 2573 const gfx::Range& range) { |
2569 // Use the routing id of Render Widget Host. | 2574 Send(new FrameHostMsg_SelectionChanged(routing_id_, selection_text, |
2570 Send(new ViewHostMsg_SelectionChanged(GetRenderWidget()->routing_id(), | 2575 static_cast<uint32_t>(offset), range)); |
2571 selection_text, | |
2572 static_cast<uint32_t>(offset), | |
2573 range)); | |
2574 } | 2576 } |
2575 | 2577 |
2576 void RenderFrameImpl::EnsureMojoBuiltinsAreAvailable( | 2578 void RenderFrameImpl::EnsureMojoBuiltinsAreAvailable( |
2577 v8::Isolate* isolate, | 2579 v8::Isolate* isolate, |
2578 v8::Local<v8::Context> context) { | 2580 v8::Local<v8::Context> context) { |
2579 gin::ModuleRegistry* registry = gin::ModuleRegistry::From(context); | 2581 gin::ModuleRegistry* registry = gin::ModuleRegistry::From(context); |
2580 if (registry->available_modules().count(mojo::edk::js::Core::kModuleName)) | 2582 if (registry->available_modules().count(mojo::edk::js::Core::kModuleName)) |
2581 return; | 2583 return; |
2582 | 2584 |
2583 v8::HandleScope handle_scope(isolate); | 2585 v8::HandleScope handle_scope(isolate); |
(...skipping 2341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4925 // If we end up reusing this WebRequest (for example, due to a #ref click), | 4927 // If we end up reusing this WebRequest (for example, due to a #ref click), |
4926 // we don't want the transition type to persist. Just clear it. | 4928 // we don't want the transition type to persist. Just clear it. |
4927 navigation_state->set_transition_type(ui::PAGE_TRANSITION_LINK); | 4929 navigation_state->set_transition_type(ui::PAGE_TRANSITION_LINK); |
4928 } | 4930 } |
4929 | 4931 |
4930 void RenderFrameImpl::didStartLoading(bool to_different_document) { | 4932 void RenderFrameImpl::didStartLoading(bool to_different_document) { |
4931 TRACE_EVENT1("navigation,rail", "RenderFrameImpl::didStartLoading", | 4933 TRACE_EVENT1("navigation,rail", "RenderFrameImpl::didStartLoading", |
4932 "id", routing_id_); | 4934 "id", routing_id_); |
4933 render_view_->FrameDidStartLoading(frame_); | 4935 render_view_->FrameDidStartLoading(frame_); |
4934 | 4936 |
| 4937 for (auto& observer : observers_) |
| 4938 observer.DidStartLoading(); |
| 4939 |
4935 // PlzNavigate: the browser is responsible for knowing the start of all | 4940 // PlzNavigate: the browser is responsible for knowing the start of all |
4936 // non-synchronous navigations. | 4941 // non-synchronous navigations. |
4937 if (!IsBrowserSideNavigationEnabled() || !to_different_document) | 4942 if (!IsBrowserSideNavigationEnabled() || !to_different_document) |
4938 Send(new FrameHostMsg_DidStartLoading(routing_id_, to_different_document)); | 4943 Send(new FrameHostMsg_DidStartLoading(routing_id_, to_different_document)); |
4939 } | 4944 } |
4940 | 4945 |
4941 void RenderFrameImpl::didStopLoading() { | 4946 void RenderFrameImpl::didStopLoading() { |
4942 TRACE_EVENT1("navigation,rail", "RenderFrameImpl::didStopLoading", | 4947 TRACE_EVENT1("navigation,rail", "RenderFrameImpl::didStopLoading", |
4943 "id", routing_id_); | 4948 "id", routing_id_); |
4944 | 4949 |
4945 // Any subframes created after this point won't be considered part of the | 4950 // Any subframes created after this point won't be considered part of the |
4946 // current history navigation (if this was one), so we don't need to track | 4951 // current history navigation (if this was one), so we don't need to track |
4947 // this state anymore. | 4952 // this state anymore. |
4948 history_subframe_unique_names_.clear(); | 4953 history_subframe_unique_names_.clear(); |
4949 | 4954 |
4950 render_view_->FrameDidStopLoading(frame_); | 4955 render_view_->FrameDidStopLoading(frame_); |
| 4956 for (auto& observer : observers_) |
| 4957 observer.DidStopLoading(); |
4951 Send(new FrameHostMsg_DidStopLoading(routing_id_)); | 4958 Send(new FrameHostMsg_DidStopLoading(routing_id_)); |
4952 } | 4959 } |
4953 | 4960 |
4954 void RenderFrameImpl::didChangeLoadProgress(double load_progress) { | 4961 void RenderFrameImpl::didChangeLoadProgress(double load_progress) { |
4955 Send(new FrameHostMsg_DidChangeLoadProgress(routing_id_, load_progress)); | 4962 Send(new FrameHostMsg_DidChangeLoadProgress(routing_id_, load_progress)); |
4956 } | 4963 } |
4957 | 4964 |
4958 void RenderFrameImpl::HandleWebAccessibilityEvent( | 4965 void RenderFrameImpl::HandleWebAccessibilityEvent( |
4959 const blink::WebAXObject& obj, blink::WebAXEvent event) { | 4966 const blink::WebAXObject& obj, blink::WebAXEvent event) { |
4960 if (render_accessibility_) | 4967 if (render_accessibility_) |
(...skipping 1587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6548 // event target. Potentially a Pepper plugin will receive the event. | 6555 // event target. Potentially a Pepper plugin will receive the event. |
6549 // In order to tell whether a plugin gets the last mouse event and which it | 6556 // In order to tell whether a plugin gets the last mouse event and which it |
6550 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets | 6557 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets |
6551 // the event, it will notify us via DidReceiveMouseEvent() and set itself as | 6558 // the event, it will notify us via DidReceiveMouseEvent() and set itself as |
6552 // |pepper_last_mouse_event_target_|. | 6559 // |pepper_last_mouse_event_target_|. |
6553 pepper_last_mouse_event_target_ = nullptr; | 6560 pepper_last_mouse_event_target_ = nullptr; |
6554 #endif | 6561 #endif |
6555 } | 6562 } |
6556 | 6563 |
6557 } // namespace content | 6564 } // namespace content |
OLD | NEW |