| OLD | NEW |
| 1 // Copyright (c) 2011 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 "ppapi/shared_impl/ppb_instance_shared.h" | 5 #include "ppapi/shared_impl/ppb_instance_shared.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "ppapi/c/pp_errors.h" | 9 #include "ppapi/c/pp_errors.h" |
| 10 #include "ppapi/c/ppb_input_event.h" | 10 #include "ppapi/c/ppb_input_event.h" |
| 11 #include "ppapi/shared_impl/ppapi_globals.h" | 11 #include "ppapi/shared_impl/ppapi_globals.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 PP_INPUTEVENT_CLASS_KEYBOARD | | 51 PP_INPUTEVENT_CLASS_KEYBOARD | |
| 52 PP_INPUTEVENT_CLASS_WHEEL | | 52 PP_INPUTEVENT_CLASS_WHEEL | |
| 53 PP_INPUTEVENT_CLASS_TOUCH | | 53 PP_INPUTEVENT_CLASS_TOUCH | |
| 54 PP_INPUTEVENT_CLASS_IME)) | 54 PP_INPUTEVENT_CLASS_IME)) |
| 55 return PP_ERROR_NOTSUPPORTED; | 55 return PP_ERROR_NOTSUPPORTED; |
| 56 | 56 |
| 57 // Everything else is valid. | 57 // Everything else is valid. |
| 58 return PP_OK; | 58 return PP_OK; |
| 59 } | 59 } |
| 60 | 60 |
| 61 #if !defined(OS_NACL) |
| 61 bool PPB_Instance_Shared::ValidateSetCursorParams(PP_MouseCursor_Type type, | 62 bool PPB_Instance_Shared::ValidateSetCursorParams(PP_MouseCursor_Type type, |
| 62 PP_Resource image, | 63 PP_Resource image, |
| 63 const PP_Point* hot_spot) { | 64 const PP_Point* hot_spot) { |
| 64 if (static_cast<int>(type) < static_cast<int>(PP_MOUSECURSOR_TYPE_CUSTOM) || | 65 if (static_cast<int>(type) < static_cast<int>(PP_MOUSECURSOR_TYPE_CUSTOM) || |
| 65 static_cast<int>(type) > static_cast<int>(PP_MOUSECURSOR_TYPE_GRABBING)) | 66 static_cast<int>(type) > static_cast<int>(PP_MOUSECURSOR_TYPE_GRABBING)) |
| 66 return false; // Cursor type out of range. | 67 return false; // Cursor type out of range. |
| 67 if (type != PP_MOUSECURSOR_TYPE_CUSTOM) { | 68 if (type != PP_MOUSECURSOR_TYPE_CUSTOM) { |
| 68 // The image must not be specified if the type isn't custom. However, we | 69 // The image must not be specified if the type isn't custom. However, we |
| 69 // don't require that the hot spot be null since the C++ wrappers and proxy | 70 // don't require that the hot spot be null since the C++ wrappers and proxy |
| 70 // pass the point by reference and it will normally be specified. | 71 // pass the point by reference and it will normally be specified. |
| (...skipping 19 matching lines...) Expand all Loading... |
| 90 // Validate image format. | 91 // Validate image format. |
| 91 if (desc.format != PPB_ImageData_Shared::GetNativeImageDataFormat()) | 92 if (desc.format != PPB_ImageData_Shared::GetNativeImageDataFormat()) |
| 92 return false; | 93 return false; |
| 93 | 94 |
| 94 // Validate the hot spot location. | 95 // Validate the hot spot location. |
| 95 if (hot_spot->x < 0 || hot_spot->x >= desc.size.width || | 96 if (hot_spot->x < 0 || hot_spot->x >= desc.size.width || |
| 96 hot_spot->y < 0 || hot_spot->y >= desc.size.height) | 97 hot_spot->y < 0 || hot_spot->y >= desc.size.height) |
| 97 return false; | 98 return false; |
| 98 return true; | 99 return true; |
| 99 } | 100 } |
| 101 #endif // !defined(OS_NACL) |
| 100 | 102 |
| 101 } // namespace ppapi | 103 } // namespace ppapi |
| OLD | NEW |