OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "webkit/plugins/ppapi/ppapi_plugin_instance.h" | 5 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 PluginInstance::PluginInstance( | 210 PluginInstance::PluginInstance( |
211 PluginDelegate* delegate, | 211 PluginDelegate* delegate, |
212 PluginModule* module, | 212 PluginModule* module, |
213 ::ppapi::PPP_Instance_Combined* instance_interface) | 213 ::ppapi::PPP_Instance_Combined* instance_interface) |
214 : delegate_(delegate), | 214 : delegate_(delegate), |
215 module_(module), | 215 module_(module), |
216 instance_interface_(instance_interface), | 216 instance_interface_(instance_interface), |
217 pp_instance_(0), | 217 pp_instance_(0), |
218 container_(NULL), | 218 container_(NULL), |
219 full_frame_(false), | 219 full_frame_(false), |
220 sent_did_change_view_(false), | |
221 has_webkit_focus_(false), | 220 has_webkit_focus_(false), |
222 has_content_area_focus_(false), | 221 has_content_area_focus_(false), |
223 find_identifier_(-1), | 222 find_identifier_(-1), |
224 plugin_find_interface_(NULL), | 223 plugin_find_interface_(NULL), |
225 plugin_messaging_interface_(NULL), | 224 plugin_messaging_interface_(NULL), |
226 plugin_input_event_interface_(NULL), | 225 plugin_input_event_interface_(NULL), |
227 plugin_private_interface_(NULL), | 226 plugin_private_interface_(NULL), |
228 plugin_pdf_interface_(NULL), | 227 plugin_pdf_interface_(NULL), |
229 plugin_policy_updated_interface_(NULL), | 228 plugin_policy_updated_interface_(NULL), |
230 plugin_selection_interface_(NULL), | 229 plugin_selection_interface_(NULL), |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
499 | 498 |
500 // If the plugin supports the private instance interface, try to retrieve its | 499 // If the plugin supports the private instance interface, try to retrieve its |
501 // instance object. | 500 // instance object. |
502 if (LoadPrivateInterface()) | 501 if (LoadPrivateInterface()) |
503 return plugin_private_interface_->GetInstanceObject(pp_instance()); | 502 return plugin_private_interface_->GetInstanceObject(pp_instance()); |
504 return PP_MakeUndefined(); | 503 return PP_MakeUndefined(); |
505 } | 504 } |
506 | 505 |
507 void PluginInstance::ViewChanged(const gfx::Rect& position, | 506 void PluginInstance::ViewChanged(const gfx::Rect& position, |
508 const gfx::Rect& clip) { | 507 const gfx::Rect& clip) { |
509 // WebKit can give weird (x,y) positions for empty clip rects (since the | 508 fullscreen_ = (fullscreen_container_ != NULL); |
510 // position technically doesn't matter). But we want to make these | 509 position_ = position; |
511 // consistent since this is given to the plugin, so force everything to 0 | |
512 // in the "everything is clipped" case. | |
513 gfx::Rect new_clip; | |
514 if (!clip.IsEmpty()) | |
515 new_clip = clip; | |
516 | 510 |
517 // Don't notify the plugin if we've already sent these same params before. | 511 if (clip.IsEmpty()) { |
518 if (sent_did_change_view_ && position == position_ && new_clip == clip_) | 512 // WebKit can give weird (x,y) positions for empty clip rects (since the |
519 return; | 513 // position technically doesn't matter). But we want to make these |
520 | 514 // consistent since this is given to the plugin, so force everything to 0 |
521 sent_did_change_view_ = true; | 515 // in the "everything is clipped" case. |
522 position_ = position; | 516 clip_ = gfx::Rect(); |
523 clip_ = new_clip; | 517 } else { |
524 fullscreen_ = (fullscreen_container_ != NULL); | 518 clip_ = clip; |
| 519 } |
525 | 520 |
526 PP_Rect pp_position, pp_clip; | 521 PP_Rect pp_position, pp_clip; |
527 RectToPPRect(position_, &pp_position); | 522 RectToPPRect(position_, &pp_position); |
528 RectToPPRect(clip_, &pp_clip); | 523 RectToPPRect(clip_, &pp_clip); |
529 instance_interface_->DidChangeView(pp_instance(), &pp_position, &pp_clip); | 524 instance_interface_->DidChangeView(pp_instance(), &pp_position, &pp_clip); |
530 } | 525 } |
531 | 526 |
532 void PluginInstance::SetWebKitFocus(bool has_focus) { | 527 void PluginInstance::SetWebKitFocus(bool has_focus) { |
533 if (has_webkit_focus_ == has_focus) | 528 if (has_webkit_focus_ == has_focus) |
534 return; | 529 return; |
(...skipping 1021 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1556 } | 1551 } |
1557 | 1552 |
1558 void PluginInstance::DoSetCursor(WebCursorInfo* cursor) { | 1553 void PluginInstance::DoSetCursor(WebCursorInfo* cursor) { |
1559 cursor_.reset(cursor); | 1554 cursor_.reset(cursor); |
1560 if (fullscreen_container_) | 1555 if (fullscreen_container_) |
1561 fullscreen_container_->DidChangeCursor(*cursor); | 1556 fullscreen_container_->DidChangeCursor(*cursor); |
1562 } | 1557 } |
1563 | 1558 |
1564 } // namespace ppapi | 1559 } // namespace ppapi |
1565 } // namespace webkit | 1560 } // namespace webkit |
OLD | NEW |