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 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 bound_graphics_ = NULL; | 352 bound_graphics_ = NULL; |
353 InvalidateRect(gfx::Rect()); | 353 InvalidateRect(gfx::Rect()); |
354 | 354 |
355 delegate()->PluginCrashed(this); | 355 delegate()->PluginCrashed(this); |
356 } | 356 } |
357 | 357 |
358 bool PluginInstance::SetCursor(PP_CursorType_Dev type, | 358 bool PluginInstance::SetCursor(PP_CursorType_Dev type, |
359 PP_Resource custom_image, | 359 PP_Resource custom_image, |
360 const PP_Point* hot_spot) { | 360 const PP_Point* hot_spot) { |
361 if (type != PP_CURSORTYPE_CUSTOM) { | 361 if (type != PP_CURSORTYPE_CUSTOM) { |
362 cursor_.reset(new WebCursorInfo(static_cast<WebCursorInfo::Type>(type))); | 362 DoSetCursor(new WebCursorInfo(static_cast<WebCursorInfo::Type>(type))); |
363 return true; | 363 return true; |
364 } | 364 } |
365 | 365 |
366 if (!hot_spot) | 366 if (!hot_spot) |
367 return false; | 367 return false; |
368 | 368 |
369 EnterResourceNoLock<PPB_ImageData_API> enter(custom_image, true); | 369 EnterResourceNoLock<PPB_ImageData_API> enter(custom_image, true); |
370 if (enter.failed()) | 370 if (enter.failed()) |
371 return false; | 371 return false; |
372 PPB_ImageData_Impl* image_data = | 372 PPB_ImageData_Impl* image_data = |
(...skipping 22 matching lines...) Expand all Loading... |
395 if (!bitmap->copyTo(&custom_cursor->customImage.getSkBitmap(), | 395 if (!bitmap->copyTo(&custom_cursor->customImage.getSkBitmap(), |
396 bitmap->config())) { | 396 bitmap->config())) { |
397 return false; | 397 return false; |
398 } | 398 } |
399 #elif WEBKIT_USING_CG | 399 #elif WEBKIT_USING_CG |
400 // TODO(yzshen): Implement it. | 400 // TODO(yzshen): Implement it. |
401 NOTIMPLEMENTED(); | 401 NOTIMPLEMENTED(); |
402 return false; | 402 return false; |
403 #endif | 403 #endif |
404 | 404 |
405 cursor_.reset(custom_cursor.release()); | 405 DoSetCursor(custom_cursor.release()); |
406 return true; | 406 return true; |
407 } | 407 } |
408 | 408 |
409 bool PluginInstance::Initialize(WebPluginContainer* container, | 409 bool PluginInstance::Initialize(WebPluginContainer* container, |
410 const std::vector<std::string>& arg_names, | 410 const std::vector<std::string>& arg_names, |
411 const std::vector<std::string>& arg_values, | 411 const std::vector<std::string>& arg_values, |
412 const GURL& plugin_url, | 412 const GURL& plugin_url, |
413 bool full_frame) { | 413 bool full_frame) { |
414 container_ = container; | 414 container_ = container; |
415 plugin_url_ = plugin_url; | 415 plugin_url_ = plugin_url; |
(...skipping 1122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1538 } | 1538 } |
1539 | 1539 |
1540 void PluginInstance::PostMessage(PP_Instance instance, PP_Var message) { | 1540 void PluginInstance::PostMessage(PP_Instance instance, PP_Var message) { |
1541 message_channel_->PostMessageToJavaScript(message); | 1541 message_channel_->PostMessageToJavaScript(message); |
1542 } | 1542 } |
1543 | 1543 |
1544 void PluginInstance::SubscribeToPolicyUpdates(PP_Instance instance) { | 1544 void PluginInstance::SubscribeToPolicyUpdates(PP_Instance instance) { |
1545 delegate()->SubscribeToPolicyUpdates(this); | 1545 delegate()->SubscribeToPolicyUpdates(this); |
1546 } | 1546 } |
1547 | 1547 |
| 1548 void PluginInstance::DoSetCursor(WebCursorInfo* cursor) { |
| 1549 cursor_.reset(cursor); |
| 1550 if (fullscreen_container_) |
| 1551 fullscreen_container_->DidChangeCursor(*cursor); |
| 1552 } |
| 1553 |
1548 } // namespace ppapi | 1554 } // namespace ppapi |
1549 } // namespace webkit | 1555 } // namespace webkit |
OLD | NEW |