| OLD | NEW |
| 1 // Copyright (c) 2012 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 // C headers | 5 // C headers |
| 6 #include <cassert> | 6 #include <cassert> |
| 7 #include <cstdio> | 7 #include <cstdio> |
| 8 | 8 |
| 9 // C++ headers | 9 // C++ headers |
| 10 #include <sstream> | 10 #include <sstream> |
| 11 #include <string> | 11 #include <string> |
| 12 | 12 |
| 13 // PPAPI headers | 13 // PPAPI headers |
| 14 #include "ppapi/cpp/completion_callback.h" | 14 #include "ppapi/cpp/completion_callback.h" |
| 15 #include "ppapi/cpp/input_event.h" | 15 #include "ppapi/cpp/input_event.h" |
| 16 #include "ppapi/cpp/instance.h" | 16 #include "ppapi/cpp/instance.h" |
| 17 #include "ppapi/cpp/module.h" | 17 #include "ppapi/cpp/module.h" |
| 18 #include "ppapi/cpp/point.h" | 18 #include "ppapi/cpp/point.h" |
| 19 #include "ppapi/cpp/var.h" | 19 #include "ppapi/cpp/var.h" |
| 20 #include "ppapi/utility/completion_callback_factory.h" | 20 #include "ppapi/utility/completion_callback_factory.h" |
| 21 | 21 |
| 22 #include "custom_events.h" | 22 #include "custom_events.h" |
| 23 #include "shared_queue.h" | 23 #include "shared_queue.h" |
| 24 | 24 |
| 25 #ifdef PostMessage | 25 #ifdef PostMessage |
| 26 #undef PostMessage | 26 #undef PostMessage |
| 27 #endif | 27 #endif |
| 28 | 28 |
| 29 namespace event_queue { | 29 namespace event_queue { |
| 30 const char* const kDidChangeView = "DidChangeView"; | 30 const char* const kDidChangeView = "DidChangeView\n"; |
| 31 const char* const kHandleInputEvent = "DidHandleInputEvent"; | 31 const char* const kHandleInputEvent = "DidHandleInputEvent\n"; |
| 32 const char* const kDidChangeFocus = "DidChangeFocus"; | 32 const char* const kDidChangeFocus = "DidChangeFocus\n"; |
| 33 const char* const kHaveFocus = "HaveFocus"; | 33 const char* const kHaveFocus = "HaveFocus\n"; |
| 34 const char* const kDontHaveFocus = "DontHaveFocus"; | 34 const char* const kDontHaveFocus = "DontHaveFocus\n"; |
| 35 const char* const kCancelMessage = "CANCEL"; | 35 const char* const kCancelMessage = "CANCEL"; |
| 36 | 36 |
| 37 // Convert a pepper inputevent modifier value into a | 37 // Convert a pepper inputevent modifier value into a |
| 38 // custom event modifier. | 38 // custom event modifier. |
| 39 unsigned int ConvertEventModifier(uint32_t pp_modifier) { | 39 unsigned int ConvertEventModifier(uint32_t pp_modifier) { |
| 40 unsigned int custom_modifier = 0; | 40 unsigned int custom_modifier = 0; |
| 41 if (pp_modifier & PP_INPUTEVENT_MODIFIER_SHIFTKEY) { | 41 if (pp_modifier & PP_INPUTEVENT_MODIFIER_SHIFTKEY) { |
| 42 custom_modifier |= kShiftKeyModifier; | 42 custom_modifier |= kShiftKeyModifier; |
| 43 } | 43 } |
| 44 if (pp_modifier & PP_INPUTEVENT_MODIFIER_CONTROLKEY) { | 44 if (pp_modifier & PP_INPUTEVENT_MODIFIER_CONTROLKEY) { |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 | 351 |
| 352 // Implement the required pp::CreateModule function that creates our specific | 352 // Implement the required pp::CreateModule function that creates our specific |
| 353 // kind of Module (in this case, EventModule). This is part of the glue code | 353 // kind of Module (in this case, EventModule). This is part of the glue code |
| 354 // that makes our example accessible to ppapi. | 354 // that makes our example accessible to ppapi. |
| 355 namespace pp { | 355 namespace pp { |
| 356 Module* CreateModule() { | 356 Module* CreateModule() { |
| 357 return new event_queue::EventModule(); | 357 return new event_queue::EventModule(); |
| 358 } | 358 } |
| 359 } | 359 } |
| 360 | 360 |
| OLD | NEW |