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 #import <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
6 #import <QuartzCore/QuartzCore.h> | 6 #import <QuartzCore/QuartzCore.h> |
7 | 7 |
8 #include "webkit/plugins/npapi/webplugin_delegate_impl.h" | 8 #include "webkit/plugins/npapi/webplugin_delegate_impl.h" |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 private: | 116 private: |
117 class VisibilityGroup { | 117 class VisibilityGroup { |
118 public: | 118 public: |
119 explicit VisibilityGroup(int timer_period) | 119 explicit VisibilityGroup(int timer_period) |
120 : timer_period_(timer_period), iterator_(delegates_.end()) {} | 120 : timer_period_(timer_period), iterator_(delegates_.end()) {} |
121 | 121 |
122 // Adds |delegate| to this visibility group. | 122 // Adds |delegate| to this visibility group. |
123 void RegisterDelegate(WebPluginDelegateImpl* delegate) { | 123 void RegisterDelegate(WebPluginDelegateImpl* delegate) { |
124 if (delegates_.empty()) { | 124 if (delegates_.empty()) { |
125 timer_.Start(base::TimeDelta::FromMilliseconds(timer_period_), | 125 timer_.Start(base::TimeDelta::FromMilliseconds(timer_period_), |
126 this, &VisibilityGroup::SendIdleEvents); | 126 this, &VisibilityGroup::SendIdleEvents, FROM_HERE); |
127 } | 127 } |
128 delegates_.insert(delegate); | 128 delegates_.insert(delegate); |
129 } | 129 } |
130 | 130 |
131 // Removes |delegate| from this visibility group. | 131 // Removes |delegate| from this visibility group. |
132 void UnregisterDelegate(WebPluginDelegateImpl* delegate) { | 132 void UnregisterDelegate(WebPluginDelegateImpl* delegate) { |
133 // If a plugin changes visibility during idle event handling, it | 133 // If a plugin changes visibility during idle event handling, it |
134 // may be removed from this set while SendIdleEvents is still iterating; | 134 // may be removed from this set while SendIdleEvents is still iterating; |
135 // if that happens and it's next on the list, increment the iterator | 135 // if that happens and it's next on the list, increment the iterator |
136 // before erasing so that the iteration won't be corrupted. | 136 // before erasing so that the iteration won't be corrupted. |
(...skipping 885 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1022 void WebPluginDelegateImpl::PluginVisibilityChanged() { | 1022 void WebPluginDelegateImpl::PluginVisibilityChanged() { |
1023 #ifndef NP_NO_CARBON | 1023 #ifndef NP_NO_CARBON |
1024 if (instance()->event_model() == NPEventModelCarbon) | 1024 if (instance()->event_model() == NPEventModelCarbon) |
1025 UpdateIdleEventRate(); | 1025 UpdateIdleEventRate(); |
1026 #endif | 1026 #endif |
1027 if (instance()->drawing_model() == NPDrawingModelCoreAnimation) { | 1027 if (instance()->drawing_model() == NPDrawingModelCoreAnimation) { |
1028 bool plugin_visible = container_is_visible_ && !clip_rect_.IsEmpty(); | 1028 bool plugin_visible = container_is_visible_ && !clip_rect_.IsEmpty(); |
1029 if (plugin_visible && !redraw_timer_->IsRunning() && windowed_handle()) { | 1029 if (plugin_visible && !redraw_timer_->IsRunning() && windowed_handle()) { |
1030 redraw_timer_->Start( | 1030 redraw_timer_->Start( |
1031 base::TimeDelta::FromMilliseconds(kCoreAnimationRedrawPeriodMs), | 1031 base::TimeDelta::FromMilliseconds(kCoreAnimationRedrawPeriodMs), |
1032 this, &WebPluginDelegateImpl::DrawLayerInSurface); | 1032 this, &WebPluginDelegateImpl::DrawLayerInSurface, FROM_HERE); |
1033 } else if (!plugin_visible) { | 1033 } else if (!plugin_visible) { |
1034 redraw_timer_->Stop(); | 1034 redraw_timer_->Stop(); |
1035 } | 1035 } |
1036 } | 1036 } |
1037 } | 1037 } |
1038 | 1038 |
1039 void WebPluginDelegateImpl::StartIme() { | 1039 void WebPluginDelegateImpl::StartIme() { |
1040 // Currently the plugin IME implementation only works on 10.6. | 1040 // Currently the plugin IME implementation only works on 10.6. |
1041 if (instance()->event_model() != NPEventModelCocoa || | 1041 if (instance()->event_model() != NPEventModelCocoa || |
1042 base::mac::IsOSLeopardOrEarlier()) { | 1042 base::mac::IsOSLeopardOrEarlier()) { |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1212 qd_manager_->SetFastPathEnabled(enabled); | 1212 qd_manager_->SetFastPathEnabled(enabled); |
1213 qd_port_.port = qd_manager_->port(); | 1213 qd_port_.port = qd_manager_->port(); |
1214 WindowlessSetWindow(); | 1214 WindowlessSetWindow(); |
1215 // Send a paint event so that the new buffer gets updated immediately. | 1215 // Send a paint event so that the new buffer gets updated immediately. |
1216 WindowlessPaint(buffer_context_, clip_rect_); | 1216 WindowlessPaint(buffer_context_, clip_rect_); |
1217 } | 1217 } |
1218 #endif // !NP_NO_QUICKDRAW | 1218 #endif // !NP_NO_QUICKDRAW |
1219 | 1219 |
1220 } // namespace npapi | 1220 } // namespace npapi |
1221 } // namespace webkit | 1221 } // namespace webkit |
OLD | NEW |