Chromium Code Reviews| 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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 109 #include "content/renderer/media/render_media_log.h" | 109 #include "content/renderer/media/render_media_log.h" |
| 110 #include "content/renderer/media/renderer_webmediaplayer_delegate.h" | 110 #include "content/renderer/media/renderer_webmediaplayer_delegate.h" |
| 111 #include "content/renderer/media/user_media_client_impl.h" | 111 #include "content/renderer/media/user_media_client_impl.h" |
| 112 #include "content/renderer/media/web_media_element_source_utils.h" | 112 #include "content/renderer/media/web_media_element_source_utils.h" |
| 113 #include "content/renderer/media/webmediaplayer_ms.h" | 113 #include "content/renderer/media/webmediaplayer_ms.h" |
| 114 #include "content/renderer/mojo/service_registry_js_wrapper.h" | 114 #include "content/renderer/mojo/service_registry_js_wrapper.h" |
| 115 #include "content/renderer/mojo_bindings_controller.h" | 115 #include "content/renderer/mojo_bindings_controller.h" |
| 116 #include "content/renderer/navigation_state_impl.h" | 116 #include "content/renderer/navigation_state_impl.h" |
| 117 #include "content/renderer/notification_permission_dispatcher.h" | 117 #include "content/renderer/notification_permission_dispatcher.h" |
| 118 #include "content/renderer/pepper/plugin_instance_throttler_impl.h" | 118 #include "content/renderer/pepper/plugin_instance_throttler_impl.h" |
| 119 #include "content/renderer/pepper/ppb_audio_impl.h" | |
| 119 #include "content/renderer/presentation/presentation_dispatcher.h" | 120 #include "content/renderer/presentation/presentation_dispatcher.h" |
| 120 #include "content/renderer/push_messaging/push_messaging_dispatcher.h" | 121 #include "content/renderer/push_messaging/push_messaging_dispatcher.h" |
| 121 #include "content/renderer/render_frame_proxy.h" | 122 #include "content/renderer/render_frame_proxy.h" |
| 122 #include "content/renderer/render_process.h" | 123 #include "content/renderer/render_process.h" |
| 123 #include "content/renderer/render_thread_impl.h" | 124 #include "content/renderer/render_thread_impl.h" |
| 124 #include "content/renderer/render_view_impl.h" | 125 #include "content/renderer/render_view_impl.h" |
| 125 #include "content/renderer/render_widget_fullscreen_pepper.h" | 126 #include "content/renderer/render_widget_fullscreen_pepper.h" |
| 126 #include "content/renderer/renderer_webapplicationcachehost_impl.h" | 127 #include "content/renderer/renderer_webapplicationcachehost_impl.h" |
| 127 #include "content/renderer/renderer_webcolorchooser_impl.h" | 128 #include "content/renderer/renderer_webcolorchooser_impl.h" |
| 128 #include "content/renderer/savable_resources.h" | 129 #include "content/renderer/savable_resources.h" |
| (...skipping 1347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1476 bool handled = true; | 1477 bool handled = true; |
| 1477 IPC_BEGIN_MESSAGE_MAP(RenderFrameImpl, msg) | 1478 IPC_BEGIN_MESSAGE_MAP(RenderFrameImpl, msg) |
| 1478 IPC_MESSAGE_HANDLER(FrameMsg_Navigate, OnNavigate) | 1479 IPC_MESSAGE_HANDLER(FrameMsg_Navigate, OnNavigate) |
| 1479 IPC_MESSAGE_HANDLER(FrameMsg_BeforeUnload, OnBeforeUnload) | 1480 IPC_MESSAGE_HANDLER(FrameMsg_BeforeUnload, OnBeforeUnload) |
| 1480 IPC_MESSAGE_HANDLER(FrameMsg_SwapOut, OnSwapOut) | 1481 IPC_MESSAGE_HANDLER(FrameMsg_SwapOut, OnSwapOut) |
| 1481 IPC_MESSAGE_HANDLER(FrameMsg_Delete, OnDeleteFrame) | 1482 IPC_MESSAGE_HANDLER(FrameMsg_Delete, OnDeleteFrame) |
| 1482 IPC_MESSAGE_HANDLER(FrameMsg_Stop, OnStop) | 1483 IPC_MESSAGE_HANDLER(FrameMsg_Stop, OnStop) |
| 1483 IPC_MESSAGE_HANDLER(FrameMsg_ContextMenuClosed, OnContextMenuClosed) | 1484 IPC_MESSAGE_HANDLER(FrameMsg_ContextMenuClosed, OnContextMenuClosed) |
| 1484 IPC_MESSAGE_HANDLER(FrameMsg_CustomContextMenuAction, | 1485 IPC_MESSAGE_HANDLER(FrameMsg_CustomContextMenuAction, |
| 1485 OnCustomContextMenuAction) | 1486 OnCustomContextMenuAction) |
| 1487 #if defined(ENABLE_PLUGINS) | |
| 1488 IPC_MESSAGE_HANDLER(FrameMsg_SetPepperVolume, OnSetPepperVolume) | |
| 1489 #endif //defined(ENABLE_PLUGINS) | |
| 1486 IPC_MESSAGE_HANDLER(InputMsg_Undo, OnUndo) | 1490 IPC_MESSAGE_HANDLER(InputMsg_Undo, OnUndo) |
| 1487 IPC_MESSAGE_HANDLER(InputMsg_Redo, OnRedo) | 1491 IPC_MESSAGE_HANDLER(InputMsg_Redo, OnRedo) |
| 1488 IPC_MESSAGE_HANDLER(InputMsg_Cut, OnCut) | 1492 IPC_MESSAGE_HANDLER(InputMsg_Cut, OnCut) |
| 1489 IPC_MESSAGE_HANDLER(InputMsg_Copy, OnCopy) | 1493 IPC_MESSAGE_HANDLER(InputMsg_Copy, OnCopy) |
| 1490 IPC_MESSAGE_HANDLER(InputMsg_Paste, OnPaste) | 1494 IPC_MESSAGE_HANDLER(InputMsg_Paste, OnPaste) |
| 1491 IPC_MESSAGE_HANDLER(InputMsg_PasteAndMatchStyle, OnPasteAndMatchStyle) | 1495 IPC_MESSAGE_HANDLER(InputMsg_PasteAndMatchStyle, OnPasteAndMatchStyle) |
| 1492 IPC_MESSAGE_HANDLER(InputMsg_Delete, OnDelete) | 1496 IPC_MESSAGE_HANDLER(InputMsg_Delete, OnDelete) |
| 1493 IPC_MESSAGE_HANDLER(InputMsg_SelectAll, OnSelectAll) | 1497 IPC_MESSAGE_HANDLER(InputMsg_SelectAll, OnSelectAll) |
| 1494 IPC_MESSAGE_HANDLER(InputMsg_SelectRange, OnSelectRange) | 1498 IPC_MESSAGE_HANDLER(InputMsg_SelectRange, OnSelectRange) |
| 1495 IPC_MESSAGE_HANDLER(InputMsg_AdjustSelectionByCharacterOffset, | 1499 IPC_MESSAGE_HANDLER(InputMsg_AdjustSelectionByCharacterOffset, |
| (...skipping 4735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6231 if (focused) | 6235 if (focused) |
| 6232 focused_pepper_plugin_ = instance; | 6236 focused_pepper_plugin_ = instance; |
| 6233 else if (focused_pepper_plugin_ == instance) | 6237 else if (focused_pepper_plugin_ == instance) |
| 6234 focused_pepper_plugin_ = nullptr; | 6238 focused_pepper_plugin_ = nullptr; |
| 6235 | 6239 |
| 6236 GetRenderWidget()->UpdateTextInputState(ShowIme::HIDE_IME, | 6240 GetRenderWidget()->UpdateTextInputState(ShowIme::HIDE_IME, |
| 6237 ChangeSource::FROM_NON_IME); | 6241 ChangeSource::FROM_NON_IME); |
| 6238 GetRenderWidget()->UpdateSelectionBounds(); | 6242 GetRenderWidget()->UpdateSelectionBounds(); |
| 6239 } | 6243 } |
| 6240 | 6244 |
| 6245 void RenderFrameImpl::PepperStartsPlayback( | |
| 6246 PepperPluginInstanceImpl* instance, PPB_Audio_Impl* ppb_audio) { | |
| 6247 // Only send start signal for the first PPB_Audio_Impl starts playback. | |
| 6248 if (pepper_audios_map_[instance->pp_instance()].empty()) { | |
| 6249 RenderFrameImpl* const render_frame = instance->render_frame(); | |
| 6250 // TODO(zqzhang): fire PepperStartsPlayback signal to the browser. | |
| 6251 } | |
| 6252 // TODO(zqzhang): it is unsure that whether a pepper instance can | |
| 6253 // have multiple audio instances. Currently let the pepper instance | |
| 6254 // delegates the SetVolume() method of all it's audio instances. | |
|
no sievers
2016/06/21 18:58:58
can you DCHECK() that it does not exist?
Zhiqiang Zhang (Slow)
2016/06/21 19:32:02
I think we should not trust Flash, so I added earl
| |
| 6255 pepper_audios_map_[instance->pp_instance()].insert(ppb_audio); | |
| 6256 } | |
| 6257 | |
| 6258 void RenderFrameImpl::PepperStopsPlayback( | |
| 6259 PepperPluginInstanceImpl* instance, PPB_Audio_Impl* ppb_audio) { | |
| 6260 pepper_audios_map_[instance->pp_instance()].erase(ppb_audio); | |
|
no sievers
2016/06/21 18:58:58
can you DCHECK() that it exists?
Zhiqiang Zhang (Slow)
2016/06/21 19:32:02
Ditto.
| |
| 6261 | |
| 6262 RenderFrameImpl* const render_frame = instance->render_frame(); | |
| 6263 // Only send stop signal for the last PPB_Audio_Impl stops playback. | |
| 6264 if (render_frame && pepper_audios_map_[instance->pp_instance()].empty()) { | |
| 6265 // TODO(zqzhang): fire PepperStopsPlayback signal to the browser. | |
| 6266 } | |
| 6267 } | |
| 6268 | |
| 6269 void RenderFrameImpl::OnSetPepperVolume(int32_t pp_instance, double volume) { | |
| 6270 if (pepper_audios_map_.count(pp_instance) == 0) return; | |
| 6271 for (auto* ppb_audio : pepper_audios_map_[pp_instance]) { | |
| 6272 ppb_audio->SetVolume(volume); | |
| 6273 } | |
| 6274 } | |
| 6241 #endif // ENABLE_PLUGINS | 6275 #endif // ENABLE_PLUGINS |
| 6242 | 6276 |
| 6243 void RenderFrameImpl::RenderWidgetSetFocus(bool enable) { | 6277 void RenderFrameImpl::RenderWidgetSetFocus(bool enable) { |
| 6244 #if defined(ENABLE_PLUGINS) | 6278 #if defined(ENABLE_PLUGINS) |
| 6245 // Notify all Pepper plugins. | 6279 // Notify all Pepper plugins. |
| 6246 for (auto* plugin : active_pepper_instances_) | 6280 for (auto* plugin : active_pepper_instances_) |
| 6247 plugin->SetContentAreaFocus(enable); | 6281 plugin->SetContentAreaFocus(enable); |
| 6248 #endif | 6282 #endif |
| 6249 } | 6283 } |
| 6250 | 6284 |
| 6251 void RenderFrameImpl::RenderWidgetWillHandleMouseEvent() { | 6285 void RenderFrameImpl::RenderWidgetWillHandleMouseEvent() { |
| 6252 #if defined(ENABLE_PLUGINS) | 6286 #if defined(ENABLE_PLUGINS) |
| 6253 // This method is called for every mouse event that the RenderWidget receives. | 6287 // This method is called for every mouse event that the RenderWidget receives. |
| 6254 // And then the mouse event is forwarded to blink, which dispatches it to the | 6288 // And then the mouse event is forwarded to blink, which dispatches it to the |
| 6255 // event target. Potentially a Pepper plugin will receive the event. | 6289 // event target. Potentially a Pepper plugin will receive the event. |
| 6256 // In order to tell whether a plugin gets the last mouse event and which it | 6290 // In order to tell whether a plugin gets the last mouse event and which it |
| 6257 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets | 6291 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets |
| 6258 // the event, it will notify us via DidReceiveMouseEvent() and set itself as | 6292 // the event, it will notify us via DidReceiveMouseEvent() and set itself as |
| 6259 // |pepper_last_mouse_event_target_|. | 6293 // |pepper_last_mouse_event_target_|. |
| 6260 pepper_last_mouse_event_target_ = nullptr; | 6294 pepper_last_mouse_event_target_ = nullptr; |
| 6261 #endif | 6295 #endif |
| 6262 } | 6296 } |
| 6263 | 6297 |
| 6264 } // namespace content | 6298 } // namespace content |
| OLD | NEW |