| 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 6233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6244 selection_rect, | 6244 selection_rect, |
| 6245 ordinal, | 6245 ordinal, |
| 6246 final_status_update)); | 6246 final_status_update)); |
| 6247 } | 6247 } |
| 6248 | 6248 |
| 6249 #if defined(ENABLE_PLUGINS) | 6249 #if defined(ENABLE_PLUGINS) |
| 6250 void RenderFrameImpl::PepperInstanceCreated( | 6250 void RenderFrameImpl::PepperInstanceCreated( |
| 6251 PepperPluginInstanceImpl* instance) { | 6251 PepperPluginInstanceImpl* instance) { |
| 6252 active_pepper_instances_.insert(instance); | 6252 active_pepper_instances_.insert(instance); |
| 6253 | 6253 |
| 6254 Send(new FrameHostMsg_PepperInstanceCreated(routing_id_)); | 6254 Send(new FrameHostMsg_PepperInstanceCreated( |
| 6255 routing_id_, instance->pp_instance())); |
| 6255 } | 6256 } |
| 6256 | 6257 |
| 6257 void RenderFrameImpl::PepperInstanceDeleted( | 6258 void RenderFrameImpl::PepperInstanceDeleted( |
| 6258 PepperPluginInstanceImpl* instance) { | 6259 PepperPluginInstanceImpl* instance) { |
| 6259 active_pepper_instances_.erase(instance); | 6260 active_pepper_instances_.erase(instance); |
| 6260 | 6261 |
| 6261 if (pepper_last_mouse_event_target_ == instance) | 6262 if (pepper_last_mouse_event_target_ == instance) |
| 6262 pepper_last_mouse_event_target_ = nullptr; | 6263 pepper_last_mouse_event_target_ = nullptr; |
| 6263 if (focused_pepper_plugin_ == instance) | 6264 if (focused_pepper_plugin_ == instance) |
| 6264 PepperFocusChanged(instance, false); | 6265 PepperFocusChanged(instance, false); |
| 6265 | 6266 |
| 6266 RenderFrameImpl* const render_frame = instance->render_frame(); | 6267 RenderFrameImpl* const render_frame = instance->render_frame(); |
| 6267 if (render_frame) | 6268 if (render_frame) { |
| 6268 render_frame->Send( | 6269 render_frame->Send( |
| 6269 new FrameHostMsg_PepperInstanceDeleted(render_frame->GetRoutingID())); | 6270 new FrameHostMsg_PepperInstanceDeleted( |
| 6271 render_frame->GetRoutingID(), |
| 6272 instance->pp_instance())); |
| 6273 } |
| 6270 } | 6274 } |
| 6271 | 6275 |
| 6272 void RenderFrameImpl::PepperFocusChanged(PepperPluginInstanceImpl* instance, | 6276 void RenderFrameImpl::PepperFocusChanged(PepperPluginInstanceImpl* instance, |
| 6273 bool focused) { | 6277 bool focused) { |
| 6274 if (focused) | 6278 if (focused) |
| 6275 focused_pepper_plugin_ = instance; | 6279 focused_pepper_plugin_ = instance; |
| 6276 else if (focused_pepper_plugin_ == instance) | 6280 else if (focused_pepper_plugin_ == instance) |
| 6277 focused_pepper_plugin_ = nullptr; | 6281 focused_pepper_plugin_ = nullptr; |
| 6278 | 6282 |
| 6279 GetRenderWidget()->UpdateTextInputState(ShowIme::HIDE_IME, | 6283 GetRenderWidget()->UpdateTextInputState(ShowIme::HIDE_IME, |
| 6280 ChangeSource::FROM_NON_IME); | 6284 ChangeSource::FROM_NON_IME); |
| 6281 GetRenderWidget()->UpdateSelectionBounds(); | 6285 GetRenderWidget()->UpdateSelectionBounds(); |
| 6282 } | 6286 } |
| 6283 | 6287 |
| 6284 void RenderFrameImpl::PepperStartsPlayback(PepperPluginInstanceImpl* instance) { | 6288 void RenderFrameImpl::PepperStartsPlayback(PepperPluginInstanceImpl* instance) { |
| 6285 // TODO(zqzhang): send PepperStartsPlayback message to the browser. | 6289 RenderFrameImpl* const render_frame = instance->render_frame(); |
| 6286 // See https://crbug.com/619084 | 6290 if (render_frame) { |
| 6291 render_frame->Send( |
| 6292 new FrameHostMsg_PepperStartsPlayback( |
| 6293 render_frame->GetRoutingID(), |
| 6294 instance->pp_instance())); |
| 6295 } |
| 6287 } | 6296 } |
| 6288 | 6297 |
| 6289 void RenderFrameImpl::PepperStopsPlayback(PepperPluginInstanceImpl* instance) { | 6298 void RenderFrameImpl::PepperStopsPlayback(PepperPluginInstanceImpl* instance) { |
| 6290 // TODO(zqzhang): send PepperStopsPlayback message to the browser. | 6299 RenderFrameImpl* const render_frame = instance->render_frame(); |
| 6291 // See https://crbug.com/619084 | 6300 if (render_frame) { |
| 6301 render_frame->Send( |
| 6302 new FrameHostMsg_PepperStopsPlayback( |
| 6303 render_frame->GetRoutingID(), |
| 6304 instance->pp_instance())); |
| 6305 } |
| 6292 } | 6306 } |
| 6293 | 6307 |
| 6294 void RenderFrameImpl::OnSetPepperVolume(int32_t pp_instance, double volume) { | 6308 void RenderFrameImpl::OnSetPepperVolume(int32_t pp_instance, double volume) { |
| 6295 PepperPluginInstanceImpl* instance = static_cast<PepperPluginInstanceImpl*>( | 6309 PepperPluginInstanceImpl* instance = static_cast<PepperPluginInstanceImpl*>( |
| 6296 PepperPluginInstance::Get(pp_instance)); | 6310 PepperPluginInstance::Get(pp_instance)); |
| 6297 if (instance) | 6311 if (instance) |
| 6298 instance->audio_controller().SetVolume(volume); | 6312 instance->audio_controller().SetVolume(volume); |
| 6299 } | 6313 } |
| 6300 #endif // ENABLE_PLUGINS | 6314 #endif // ENABLE_PLUGINS |
| 6301 | 6315 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 6314 // event target. Potentially a Pepper plugin will receive the event. | 6328 // event target. Potentially a Pepper plugin will receive the event. |
| 6315 // In order to tell whether a plugin gets the last mouse event and which it | 6329 // In order to tell whether a plugin gets the last mouse event and which it |
| 6316 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets | 6330 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets |
| 6317 // the event, it will notify us via DidReceiveMouseEvent() and set itself as | 6331 // the event, it will notify us via DidReceiveMouseEvent() and set itself as |
| 6318 // |pepper_last_mouse_event_target_|. | 6332 // |pepper_last_mouse_event_target_|. |
| 6319 pepper_last_mouse_event_target_ = nullptr; | 6333 pepper_last_mouse_event_target_ = nullptr; |
| 6320 #endif | 6334 #endif |
| 6321 } | 6335 } |
| 6322 | 6336 |
| 6323 } // namespace content | 6337 } // namespace content |
| OLD | NEW |