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/ppb_flash_menu_impl.h" | 5 #include "webkit/plugins/ppapi/ppb_flash_menu_impl.h" |
6 | 6 |
7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "ppapi/c/pp_completion_callback.h" | 8 #include "ppapi/c/pp_completion_callback.h" |
9 #include "ui/gfx/point.h" | 9 #include "ui/gfx/point.h" |
10 #include "webkit/glue/webmenuitem.h" | 10 #include "webkit/glue/webmenuitem.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 return BoolToPPBool(!!Resource::GetAs<PPB_Flash_Menu_Impl>(resource)); | 34 return BoolToPPBool(!!Resource::GetAs<PPB_Flash_Menu_Impl>(resource)); |
35 } | 35 } |
36 | 36 |
37 int32_t Show(PP_Resource menu_id, | 37 int32_t Show(PP_Resource menu_id, |
38 const PP_Point* location, | 38 const PP_Point* location, |
39 int32_t* selected_id, | 39 int32_t* selected_id, |
40 PP_CompletionCallback callback) { | 40 PP_CompletionCallback callback) { |
41 scoped_refptr<PPB_Flash_Menu_Impl> menu( | 41 scoped_refptr<PPB_Flash_Menu_Impl> menu( |
42 Resource::GetAs<PPB_Flash_Menu_Impl>(menu_id)); | 42 Resource::GetAs<PPB_Flash_Menu_Impl>(menu_id)); |
43 if (!menu.get()) | 43 if (!menu.get()) |
44 return PP_ERROR_BADRESOURCE; | 44 return MayForceCallback(callback, PP_ERROR_BADRESOURCE); |
45 | 45 |
46 return menu->Show(location, selected_id, callback); | 46 int32_t result = menu->Show(location, selected_id, callback); |
| 47 return MayForceCallback(callback, result); |
47 } | 48 } |
48 | 49 |
49 const PPB_Flash_Menu ppb_flash_menu = { | 50 const PPB_Flash_Menu ppb_flash_menu = { |
50 &Create, | 51 &Create, |
51 &IsFlashMenu, | 52 &IsFlashMenu, |
52 &Show, | 53 &Show, |
53 }; | 54 }; |
54 | 55 |
55 // Maximum depth of submenus allowed (e.g., 1 indicates that submenus are | 56 // Maximum depth of submenus allowed (e.g., 1 indicates that submenus are |
56 // allowed, but not sub-submenus). | 57 // allowed, but not sub-submenus). |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 | 214 |
214 scoped_refptr<TrackedCompletionCallback> callback; | 215 scoped_refptr<TrackedCompletionCallback> callback; |
215 callback.swap(callback_); | 216 callback.swap(callback_); |
216 selected_id_out_ = NULL; | 217 selected_id_out_ = NULL; |
217 | 218 |
218 callback->Run(rv); // Will complete abortively if necessary. | 219 callback->Run(rv); // Will complete abortively if necessary. |
219 } | 220 } |
220 | 221 |
221 } // namespace ppapi | 222 } // namespace ppapi |
222 } // namespace webkit | 223 } // namespace webkit |
OLD | NEW |