OLD | NEW |
1 // Copyright (c) 2010 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/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/scoped_ptr.h" | 9 #include "base/scoped_ptr.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
11 #include "ppapi/c/dev/ppb_find_dev.h" | 11 #include "ppapi/c/dev/ppb_find_dev.h" |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 COMPILE_ASSERT_MATCHING_ENUM(TypeCell, PP_CURSORTYPE_CELL); | 138 COMPILE_ASSERT_MATCHING_ENUM(TypeCell, PP_CURSORTYPE_CELL); |
139 COMPILE_ASSERT_MATCHING_ENUM(TypeContextMenu, PP_CURSORTYPE_CONTEXTMENU); | 139 COMPILE_ASSERT_MATCHING_ENUM(TypeContextMenu, PP_CURSORTYPE_CONTEXTMENU); |
140 COMPILE_ASSERT_MATCHING_ENUM(TypeAlias, PP_CURSORTYPE_ALIAS); | 140 COMPILE_ASSERT_MATCHING_ENUM(TypeAlias, PP_CURSORTYPE_ALIAS); |
141 COMPILE_ASSERT_MATCHING_ENUM(TypeProgress, PP_CURSORTYPE_PROGRESS); | 141 COMPILE_ASSERT_MATCHING_ENUM(TypeProgress, PP_CURSORTYPE_PROGRESS); |
142 COMPILE_ASSERT_MATCHING_ENUM(TypeNoDrop, PP_CURSORTYPE_NODROP); | 142 COMPILE_ASSERT_MATCHING_ENUM(TypeNoDrop, PP_CURSORTYPE_NODROP); |
143 COMPILE_ASSERT_MATCHING_ENUM(TypeCopy, PP_CURSORTYPE_COPY); | 143 COMPILE_ASSERT_MATCHING_ENUM(TypeCopy, PP_CURSORTYPE_COPY); |
144 COMPILE_ASSERT_MATCHING_ENUM(TypeNone, PP_CURSORTYPE_NONE); | 144 COMPILE_ASSERT_MATCHING_ENUM(TypeNone, PP_CURSORTYPE_NONE); |
145 COMPILE_ASSERT_MATCHING_ENUM(TypeNotAllowed, PP_CURSORTYPE_NOTALLOWED); | 145 COMPILE_ASSERT_MATCHING_ENUM(TypeNotAllowed, PP_CURSORTYPE_NOTALLOWED); |
146 COMPILE_ASSERT_MATCHING_ENUM(TypeZoomIn, PP_CURSORTYPE_ZOOMIN); | 146 COMPILE_ASSERT_MATCHING_ENUM(TypeZoomIn, PP_CURSORTYPE_ZOOMIN); |
147 COMPILE_ASSERT_MATCHING_ENUM(TypeZoomOut, PP_CURSORTYPE_ZOOMOUT); | 147 COMPILE_ASSERT_MATCHING_ENUM(TypeZoomOut, PP_CURSORTYPE_ZOOMOUT); |
148 COMPILE_ASSERT_MATCHING_ENUM(TypeCustom, PP_CURSORTYPE_CUSTOM); | 148 // Do not assert WebCursorInfo::TypeCustom == PP_CURSORTYPE_CUSTOM; |
| 149 // PP_CURSORTYPE_CUSTOM is pinned to allow new cursor types. |
149 | 150 |
150 void RectToPPRect(const gfx::Rect& input, PP_Rect* output) { | 151 void RectToPPRect(const gfx::Rect& input, PP_Rect* output) { |
151 *output = PP_MakeRectFromXYWH(input.x(), input.y(), | 152 *output = PP_MakeRectFromXYWH(input.x(), input.y(), |
152 input.width(), input.height()); | 153 input.width(), input.height()); |
153 } | 154 } |
154 | 155 |
155 PP_Var GetWindowObject(PP_Instance instance_id) { | 156 PP_Var GetWindowObject(PP_Instance instance_id) { |
156 PluginInstance* instance = ResourceTracker::Get()->GetInstance(instance_id); | 157 PluginInstance* instance = ResourceTracker::Get()->GetInstance(instance_id); |
157 if (!instance) | 158 if (!instance) |
158 return PP_MakeUndefined(); | 159 return PP_MakeUndefined(); |
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
504 if (!graphics_3d->BindToInstance(true)) | 505 if (!graphics_3d->BindToInstance(true)) |
505 return false; | 506 return false; |
506 | 507 |
507 bound_graphics_ = graphics_3d; | 508 bound_graphics_ = graphics_3d; |
508 } | 509 } |
509 | 510 |
510 return true; | 511 return true; |
511 } | 512 } |
512 | 513 |
513 bool PluginInstance::SetCursor(PP_CursorType_Dev type) { | 514 bool PluginInstance::SetCursor(PP_CursorType_Dev type) { |
| 515 if (type == PP_CURSORTYPE_CUSTOM) { |
| 516 // TODO(neb): implement custom cursors. |
| 517 // (Remember that PP_CURSORTYPE_CUSTOM != WebCursorInfo::TypeCustom.) |
| 518 NOTIMPLEMENTED(); |
| 519 return false; |
| 520 } |
514 cursor_.reset(new WebCursorInfo(static_cast<WebCursorInfo::Type>(type))); | 521 cursor_.reset(new WebCursorInfo(static_cast<WebCursorInfo::Type>(type))); |
515 return true; | 522 return true; |
516 } | 523 } |
517 | 524 |
518 PP_Var PluginInstance::ExecuteScript(PP_Var script, PP_Var* exception) { | 525 PP_Var PluginInstance::ExecuteScript(PP_Var script, PP_Var* exception) { |
519 TryCatch try_catch(module(), exception); | 526 TryCatch try_catch(module(), exception); |
520 if (try_catch.has_exception()) | 527 if (try_catch.has_exception()) |
521 return PP_MakeUndefined(); | 528 return PP_MakeUndefined(); |
522 | 529 |
523 // Convert the script into an inconvenient NPString object. | 530 // Convert the script into an inconvenient NPString object. |
(...skipping 756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1280 return found->second; | 1287 return found->second; |
1281 } | 1288 } |
1282 | 1289 |
1283 bool PluginInstance::IsFullPagePlugin() const { | 1290 bool PluginInstance::IsFullPagePlugin() const { |
1284 WebFrame* frame = container()->element().document().frame(); | 1291 WebFrame* frame = container()->element().document().frame(); |
1285 return frame->view()->mainFrame()->document().isPluginDocument(); | 1292 return frame->view()->mainFrame()->document().isPluginDocument(); |
1286 } | 1293 } |
1287 | 1294 |
1288 } // namespace ppapi | 1295 } // namespace ppapi |
1289 } // namespace webkit | 1296 } // namespace webkit |
OLD | NEW |