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 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 &IsFullFrame, | 226 &IsFullFrame, |
227 &ExecuteScript | 227 &ExecuteScript |
228 }; | 228 }; |
229 | 229 |
230 const PPB_Instance_Private ppb_instance_private = { | 230 const PPB_Instance_Private ppb_instance_private = { |
231 &GetWindowObject, | 231 &GetWindowObject, |
232 &GetOwnerElementObject, | 232 &GetOwnerElementObject, |
233 &ExecuteScript | 233 &ExecuteScript |
234 }; | 234 }; |
235 | 235 |
236 void NumberOfFindResultsChanged(PP_Instance instance_id, | |
237 int32_t total, | |
238 PP_Bool final_result) { | |
239 PluginInstance* instance = ResourceTracker::Get()->GetInstance(instance_id); | |
240 if (!instance) | |
241 return; | |
242 | |
243 DCHECK_NE(instance->find_identifier(), -1); | |
244 instance->delegate()->NumberOfFindResultsChanged( | |
245 instance->find_identifier(), total, PPBoolToBool(final_result)); | |
246 } | |
247 | |
248 void SelectedFindResultChanged(PP_Instance instance_id, | |
249 int32_t index) { | |
250 PluginInstance* instance = ResourceTracker::Get()->GetInstance(instance_id); | |
251 if (!instance) | |
252 return; | |
253 | |
254 DCHECK_NE(instance->find_identifier(), -1); | |
255 instance->delegate()->SelectedFindResultChanged( | |
256 instance->find_identifier(), index); | |
257 } | |
258 | |
259 const PPB_Find_Dev ppb_find = { | |
260 &NumberOfFindResultsChanged, | |
261 &SelectedFindResultChanged, | |
262 }; | |
263 | |
264 PP_Bool IsFullscreen(PP_Instance instance_id) { | 236 PP_Bool IsFullscreen(PP_Instance instance_id) { |
265 PluginInstance* instance = ResourceTracker::Get()->GetInstance(instance_id); | 237 PluginInstance* instance = ResourceTracker::Get()->GetInstance(instance_id); |
266 if (!instance) | 238 if (!instance) |
267 return PP_FALSE; | 239 return PP_FALSE; |
268 return BoolToPPBool(instance->IsFullscreen()); | 240 return BoolToPPBool(instance->IsFullscreen()); |
269 } | 241 } |
270 | 242 |
271 PP_Bool SetFullscreen(PP_Instance instance_id, PP_Bool fullscreen) { | 243 PP_Bool SetFullscreen(PP_Instance instance_id, PP_Bool fullscreen) { |
272 PluginInstance* instance = ResourceTracker::Get()->GetInstance(instance_id); | 244 PluginInstance* instance = ResourceTracker::Get()->GetInstance(instance_id); |
273 if (!instance) | 245 if (!instance) |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 const void* PluginInstance::GetInterface(const char* if_name) { | 375 const void* PluginInstance::GetInterface(const char* if_name) { |
404 if (strcmp(if_name, PPB_INSTANCE_INTERFACE) == 0) { | 376 if (strcmp(if_name, PPB_INSTANCE_INTERFACE) == 0) { |
405 return &ppb_instance; | 377 return &ppb_instance; |
406 } else if (strcmp(if_name, PPB_INSTANCE_INTERFACE_0_4) == 0) { | 378 } else if (strcmp(if_name, PPB_INSTANCE_INTERFACE_0_4) == 0) { |
407 return &ppb_instance_0_4; | 379 return &ppb_instance_0_4; |
408 } | 380 } |
409 return NULL; | 381 return NULL; |
410 } | 382 } |
411 | 383 |
412 // static | 384 // static |
413 const PPB_Find_Dev* PluginInstance::GetFindInterface() { | |
414 return &ppb_find; | |
415 } | |
416 | |
417 // static | |
418 const PPB_Fullscreen_Dev* PluginInstance::GetFullscreenInterface() { | 385 const PPB_Fullscreen_Dev* PluginInstance::GetFullscreenInterface() { |
419 return &ppb_fullscreen; | 386 return &ppb_fullscreen; |
420 } | 387 } |
421 | 388 |
422 // static | 389 // static |
423 const PPB_Messaging* PluginInstance::GetMessagingInterface() { | 390 const PPB_Messaging* PluginInstance::GetMessagingInterface() { |
424 return &ppb_messaging; | 391 return &ppb_messaging; |
425 } | 392 } |
426 | 393 |
427 // static | 394 // static |
(...skipping 1183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1611 return found->second; | 1578 return found->second; |
1612 } | 1579 } |
1613 | 1580 |
1614 bool PluginInstance::IsFullPagePlugin() const { | 1581 bool PluginInstance::IsFullPagePlugin() const { |
1615 WebFrame* frame = container()->element().document().frame(); | 1582 WebFrame* frame = container()->element().document().frame(); |
1616 return frame->view()->mainFrame()->document().isPluginDocument(); | 1583 return frame->view()->mainFrame()->document().isPluginDocument(); |
1617 } | 1584 } |
1618 | 1585 |
1619 } // namespace ppapi | 1586 } // namespace ppapi |
1620 } // namespace webkit | 1587 } // namespace webkit |
OLD | NEW |