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