| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 <stdint.h> | 5 #include <stdint.h> |
| 6 #include <string.h> |
| 6 | 7 |
| 7 #include <sstream> | 8 #include <sstream> |
| 8 #include <utility> | 9 #include <utility> |
| 9 | 10 |
| 10 #include "ppapi/cpp/completion_callback.h" | 11 #include "ppapi/cpp/completion_callback.h" |
| 11 #include "ppapi/cpp/graphics_2d.h" | 12 #include "ppapi/cpp/graphics_2d.h" |
| 12 #include "ppapi/cpp/image_data.h" | 13 #include "ppapi/cpp/image_data.h" |
| 13 #include "ppapi/cpp/input_event.h" | 14 #include "ppapi/cpp/input_event.h" |
| 14 #include "ppapi/cpp/instance.h" | 15 #include "ppapi/cpp/instance.h" |
| 15 #include "ppapi/cpp/module.h" | 16 #include "ppapi/cpp/module.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 29 // - On first paint, the plugin posts a 'loaded' message to its owner element. | 30 // - On first paint, the plugin posts a 'loaded' message to its owner element. |
| 30 // - On subsequent paints, the plugin posts a 'painted' message instead. | 31 // - On subsequent paints, the plugin posts a 'painted' message instead. |
| 31 // - Keyboard and mouse input events are logged to the console. | 32 // - Keyboard and mouse input events are logged to the console. |
| 32 class BlinkTestInstance : public pp::Instance { | 33 class BlinkTestInstance : public pp::Instance { |
| 33 public: | 34 public: |
| 34 explicit BlinkTestInstance(PP_Instance instance) | 35 explicit BlinkTestInstance(PP_Instance instance) |
| 35 : pp::Instance(instance), first_paint_(true) {} | 36 : pp::Instance(instance), first_paint_(true) {} |
| 36 ~BlinkTestInstance() override {} | 37 ~BlinkTestInstance() override {} |
| 37 | 38 |
| 38 bool Init(uint32_t argc, const char* argn[], const char* argv[]) { | 39 bool Init(uint32_t argc, const char* argn[], const char* argv[]) { |
| 40 // Used by layout tests that want to inspect the args the plugin is |
| 41 // instantiated with. |
| 42 for (uint32_t i = 0; i < argc; ++i) { |
| 43 if (!strcmp(argn[i], "logargs")) { |
| 44 LogMessage("plugin args:"); |
| 45 for (uint32_t j = 0; j < argc; ++j) |
| 46 LogMessage(" name = ", argn[j], ", value = ", argv[j]); |
| 47 } |
| 48 } |
| 39 return RequestFilteringInputEvents(PP_INPUTEVENT_CLASS_MOUSE | | 49 return RequestFilteringInputEvents(PP_INPUTEVENT_CLASS_MOUSE | |
| 40 PP_INPUTEVENT_CLASS_KEYBOARD) == PP_OK; | 50 PP_INPUTEVENT_CLASS_KEYBOARD) == PP_OK; |
| 41 } | 51 } |
| 42 | 52 |
| 43 void DidChangeView(const pp::View& view) override { | 53 void DidChangeView(const pp::View& view) override { |
| 44 view_ = view; | 54 view_ = view; |
| 45 device_context_ = pp::Graphics2D(this, view_.GetRect().size(), true); | 55 device_context_ = pp::Graphics2D(this, view_.GetRect().size(), true); |
| 46 if (!BindGraphics(device_context_)) | 56 if (!BindGraphics(device_context_)) |
| 47 return; | 57 return; |
| 48 | 58 |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 | 182 |
| 173 } // namespace | 183 } // namespace |
| 174 | 184 |
| 175 namespace pp { | 185 namespace pp { |
| 176 | 186 |
| 177 Module* CreateModule() { | 187 Module* CreateModule() { |
| 178 return new BlinkTestModule(); | 188 return new BlinkTestModule(); |
| 179 } | 189 } |
| 180 | 190 |
| 181 } // namespace pp | 191 } // namespace pp |
| OLD | NEW |