OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/npapi/webplugin_delegate_impl.h" | 5 #include "webkit/plugins/npapi/webplugin_delegate_impl.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 // This is called when internal WebKit focus (the focused element on the page) | 150 // This is called when internal WebKit focus (the focused element on the page) |
151 // changes, but plugins need to know about OS-level focus, so we have an extra | 151 // changes, but plugins need to know about OS-level focus, so we have an extra |
152 // layer of focus tracking. | 152 // layer of focus tracking. |
153 // | 153 // |
154 // On Windows, historically browsers did not set focus events to windowless | 154 // On Windows, historically browsers did not set focus events to windowless |
155 // plugins when the toplevel window focus changes. Sending such focus events | 155 // plugins when the toplevel window focus changes. Sending such focus events |
156 // breaks full screen mode in Flash because it will come out of full screen | 156 // breaks full screen mode in Flash because it will come out of full screen |
157 // mode when it loses focus, and its full screen window causes the browser to | 157 // mode when it loses focus, and its full screen window causes the browser to |
158 // lose focus. | 158 // lose focus. |
159 has_webkit_focus_ = focused; | 159 has_webkit_focus_ = focused; |
160 #ifndef OS_WIN | 160 #if !defined(OS_WIN) |
161 if (containing_view_has_focus_) | 161 if (containing_view_has_focus_) |
162 SetPluginHasFocus(focused); | 162 SetPluginHasFocus(focused); |
163 #else | 163 #else |
164 SetPluginHasFocus(focused); | 164 SetPluginHasFocus(focused); |
165 #endif | 165 #endif |
166 } | 166 } |
167 | 167 |
168 void WebPluginDelegateImpl::SetPluginHasFocus(bool focused) { | 168 void WebPluginDelegateImpl::SetPluginHasFocus(bool focused) { |
169 if (focused == plugin_has_focus_) | 169 if (focused == plugin_has_focus_) |
170 return; | 170 return; |
171 if (PlatformSetPluginHasFocus(focused)) | 171 if (PlatformSetPluginHasFocus(focused)) |
172 plugin_has_focus_ = focused; | 172 plugin_has_focus_ = focused; |
173 } | 173 } |
174 | 174 |
175 void WebPluginDelegateImpl::SetContentAreaHasFocus(bool has_focus) { | 175 void WebPluginDelegateImpl::SetContentAreaHasFocus(bool has_focus) { |
176 containing_view_has_focus_ = has_focus; | 176 containing_view_has_focus_ = has_focus; |
177 if (!windowless_) | 177 if (!windowless_) |
178 return; | 178 return; |
179 #ifndef OS_WIN // See SetFocus above. | 179 #if !defined(OS_WIN) // See SetFocus above. |
180 SetPluginHasFocus(containing_view_has_focus_ && has_webkit_focus_); | 180 SetPluginHasFocus(containing_view_has_focus_ && has_webkit_focus_); |
181 #endif | 181 #endif |
182 } | 182 } |
183 | 183 |
184 NPObject* WebPluginDelegateImpl::GetPluginScriptableObject() { | 184 NPObject* WebPluginDelegateImpl::GetPluginScriptableObject() { |
185 return instance_->GetPluginScriptableObject(); | 185 return instance_->GetPluginScriptableObject(); |
186 } | 186 } |
187 | 187 |
188 bool WebPluginDelegateImpl::GetFormValue(string16* value) { | 188 bool WebPluginDelegateImpl::GetFormValue(string16* value) { |
189 return instance_->GetFormValue(value); | 189 return instance_->GetFormValue(value); |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 resource_id, url, std::string(), notify_id); | 291 resource_id, url, std::string(), notify_id); |
292 } | 292 } |
293 | 293 |
294 WebPluginResourceClient* WebPluginDelegateImpl::CreateSeekableResourceClient( | 294 WebPluginResourceClient* WebPluginDelegateImpl::CreateSeekableResourceClient( |
295 unsigned long resource_id, int range_request_id) { | 295 unsigned long resource_id, int range_request_id) { |
296 return instance()->GetRangeRequest(range_request_id); | 296 return instance()->GetRangeRequest(range_request_id); |
297 } | 297 } |
298 | 298 |
299 } // namespace npapi | 299 } // namespace npapi |
300 } // namespace webkit | 300 } // namespace webkit |
OLD | NEW |