OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/tools/test_shell/webview_host.h" | 5 #include "webkit/tools/test_shell/webview_host.h" |
6 | 6 |
7 #include "base/gfx/platform_canvas_win.h" | 7 #include "base/gfx/platform_canvas.h" |
8 #include "base/gfx/rect.h" | 8 #include "base/gfx/rect.h" |
9 #include "base/gfx/size.h" | 9 #include "base/gfx/size.h" |
10 #include "base/win_util.h" | 10 #include "base/win_util.h" |
11 #include "webkit/glue/webinputevent.h" | 11 #include "webkit/glue/webinputevent.h" |
12 #include "webkit/glue/webview.h" | 12 #include "webkit/glue/webview.h" |
13 | 13 |
14 static const wchar_t kWindowClassName[] = L"WebViewHost"; | 14 static const wchar_t kWindowClassName[] = L"WebViewHost"; |
15 | 15 |
16 /*static*/ | 16 /*static*/ |
17 WebViewHost* WebViewHost::Create(HWND parent_window, WebViewDelegate* delegate, | 17 WebViewHost* WebViewHost::Create(gfx::WindowHandle parent_window, |
| 18 WebViewDelegate* delegate, |
18 const WebPreferences& prefs) { | 19 const WebPreferences& prefs) { |
19 WebViewHost* host = new WebViewHost(); | 20 WebViewHost* host = new WebViewHost(); |
20 | 21 |
21 static bool registered_class = false; | 22 static bool registered_class = false; |
22 if (!registered_class) { | 23 if (!registered_class) { |
23 WNDCLASSEX wcex = {0}; | 24 WNDCLASSEX wcex = {0}; |
24 wcex.cbSize = sizeof(wcex); | 25 wcex.cbSize = sizeof(wcex); |
25 wcex.style = CS_DBLCLKS; | 26 wcex.style = CS_DBLCLKS; |
26 wcex.lpfnWndProc = WebWidgetHost::WndProc; | 27 wcex.lpfnWndProc = WebWidgetHost::WndProc; |
27 wcex.hInstance = GetModuleHandle(NULL); | 28 wcex.hInstance = GetModuleHandle(NULL); |
28 wcex.hCursor = LoadCursor(NULL, IDC_ARROW); | 29 wcex.hCursor = LoadCursor(NULL, IDC_ARROW); |
29 wcex.lpszClassName = kWindowClassName; | 30 wcex.lpszClassName = kWindowClassName; |
30 RegisterClassEx(&wcex); | 31 RegisterClassEx(&wcex); |
31 registered_class = true; | 32 registered_class = true; |
32 } | 33 } |
33 | 34 |
34 host->hwnd_ = CreateWindow(kWindowClassName, NULL, | 35 host->view_ = CreateWindow(kWindowClassName, NULL, |
35 WS_CHILD|WS_CLIPCHILDREN|WS_CLIPSIBLINGS, 0, 0, | 36 WS_CHILD|WS_CLIPCHILDREN|WS_CLIPSIBLINGS, 0, 0, |
36 0, 0, parent_window, NULL, | 37 0, 0, parent_window, NULL, |
37 GetModuleHandle(NULL), NULL); | 38 GetModuleHandle(NULL), NULL); |
38 win_util::SetWindowUserData(host->hwnd_, host); | 39 win_util::SetWindowUserData(host->view_, host); |
39 | 40 |
40 host->webwidget_ = WebView::Create(delegate, prefs); | 41 host->webwidget_ = WebView::Create(delegate, prefs); |
41 | 42 |
42 return host; | 43 return host; |
43 } | 44 } |
44 | 45 |
45 WebView* WebViewHost::webview() const { | 46 WebView* WebViewHost::webview() const { |
46 return static_cast<WebView*>(webwidget_); | 47 return static_cast<WebView*>(webwidget_); |
47 } | 48 } |
48 | 49 |
OLD | NEW |