OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/glue/plugins/test/plugin_create_instance_in_paint.h" | 5 #include "webkit/glue/plugins/test/plugin_create_instance_in_paint.h" |
6 | 6 |
7 #include "webkit/glue/plugins/test/plugin_client.h" | 7 #include "webkit/glue/plugins/test/plugin_client.h" |
8 | 8 |
9 namespace NPAPIClient { | 9 namespace NPAPIClient { |
10 | 10 |
11 CreateInstanceInPaintTest::CreateInstanceInPaintTest( | 11 CreateInstanceInPaintTest::CreateInstanceInPaintTest( |
12 NPP id, NPNetscapeFuncs *host_functions) | 12 NPP id, NPNetscapeFuncs *host_functions) |
13 : PluginTest(id, host_functions), | 13 : PluginTest(id, host_functions), |
14 window_(NULL), created_(false) { | 14 window_(NULL), created_(false) { |
15 } | 15 } |
16 | 16 |
17 NPError CreateInstanceInPaintTest::SetWindow(NPWindow* pNPWindow) { | 17 NPError CreateInstanceInPaintTest::SetWindow(NPWindow* pNPWindow) { |
| 18 if (pNPWindow->window == NULL) |
| 19 return NPERR_NO_ERROR; |
| 20 |
18 if (test_id() == "1") { | 21 if (test_id() == "1") { |
19 if (!window_) { | 22 if (!window_) { |
20 static ATOM window_class = 0; | 23 static ATOM window_class = 0; |
21 if (!window_class) { | 24 if (!window_class) { |
22 WNDCLASSEX wcex; | 25 WNDCLASSEX wcex; |
23 wcex.cbSize = sizeof(WNDCLASSEX); | 26 wcex.cbSize = sizeof(WNDCLASSEX); |
24 wcex.style = CS_DBLCLKS; | 27 wcex.style = CS_DBLCLKS; |
25 wcex.lpfnWndProc = | 28 wcex.lpfnWndProc = |
26 &NPAPIClient::CreateInstanceInPaintTest::WindowProc; | 29 &NPAPIClient::CreateInstanceInPaintTest::WindowProc; |
27 wcex.cbClsExtra = 0; | 30 wcex.cbClsExtra = 0; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 this_instance->HostFunctions()->geturlnotify( | 67 this_instance->HostFunctions()->geturlnotify( |
65 this_instance->id(), "javascript:CreateNewInstance()", NULL, | 68 this_instance->id(), "javascript:CreateNewInstance()", NULL, |
66 reinterpret_cast<void*>(1)); | 69 reinterpret_cast<void*>(1)); |
67 } | 70 } |
68 } | 71 } |
69 | 72 |
70 return DefWindowProc(window, message, wparam, lparam); | 73 return DefWindowProc(window, message, wparam, lparam); |
71 } | 74 } |
72 | 75 |
73 } // namespace NPAPIClient | 76 } // namespace NPAPIClient |
OLD | NEW |