Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(427)

Side by Side Diff: webkit/tools/test_shell/webwidget_host.h

Issue 1818: Bulk fixes to get Mac Test Shell more compile-happy. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « webkit/tools/test_shell/webview_host.cc ('k') | webkit/tools/test_shell/webwidget_host.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #ifndef WEBKIT_TOOLS_TEST_SHELL_WEBWIDGET_HOST_H__ 5 #ifndef WEBKIT_TOOLS_TEST_SHELL_WEBWIDGET_HOST_H_
6 #define WEBKIT_TOOLS_TEST_SHELL_WEBWIDGET_HOST_H__ 6 #define WEBKIT_TOOLS_TEST_SHELL_WEBWIDGET_HOST_H_
7 7
8 #include <windows.h> 8 #include "base/basictypes.h"
9 9 #include "base/gfx/native_widget_types.h"
10 #include "base/gfx/platform_canvas.h"
10 #include "base/gfx/rect.h" 11 #include "base/gfx/rect.h"
11 #include "base/scoped_ptr.h" 12 #include "base/scoped_ptr.h"
12 13
13 class WebWidget; 14 class WebWidget;
14 class WebWidgetDelegate; 15 class WebWidgetDelegate;
15 16
16 namespace gfx { 17 namespace gfx {
17 class PlatformCanvasWin;
18 class Size; 18 class Size;
19 } 19 }
20 20
21 // This class is a simple HWND-based host for a WebWidget 21 // This class is a simple ViewHandle-based host for a WebWidget
22 class WebWidgetHost { 22 class WebWidgetHost {
23 public: 23 public:
24 // The new instance is deleted once the associated HWND is destroyed. The 24 // The new instance is deleted once the associated ViewHandle is destroyed.
25 // newly created window should be resized after it is created, using the 25 // The newly created window should be resized after it is created, using the
26 // MoveWindow (or equivalent) function. 26 // MoveWindow (or equivalent) function.
27 static WebWidgetHost* Create(HWND parent_window, WebWidgetDelegate* delegate); 27 static WebWidgetHost* Create(gfx::WindowHandle parent_window,
28 WebWidgetDelegate* delegate);
28 29
29 static WebWidgetHost* FromWindow(HWND hwnd); 30 static WebWidgetHost* FromWindow(gfx::WindowHandle view);
31 #if defined(OS_MACOSX)
32 static void HandleEvent(gfx::WindowHandle window, NSEvent *event);
33 #endif
30 34
31 HWND window_handle() const { return hwnd_; } 35 gfx::ViewHandle window_handle() const { return view_; }
32 WebWidget* webwidget() const { return webwidget_; } 36 WebWidget* webwidget() const { return webwidget_; }
33 37
34 void DidInvalidateRect(const gfx::Rect& rect); 38 void DidInvalidateRect(const gfx::Rect& rect);
35 void DidScrollRect(int dx, int dy, const gfx::Rect& clip_rect); 39 void DidScrollRect(int dx, int dy, const gfx::Rect& clip_rect);
40 #if defined(OS_WIN)
36 void SetCursor(HCURSOR cursor); 41 void SetCursor(HCURSOR cursor);
42 #endif
37 43
38 void DiscardBackingStore(); 44 void DiscardBackingStore();
39 45
40 protected: 46 protected:
41 WebWidgetHost(); 47 WebWidgetHost();
42 ~WebWidgetHost(); 48 ~WebWidgetHost();
43 49
50 #if defined(OS_WIN)
44 // Per-class wndproc. Returns true if the event should be swallowed. 51 // Per-class wndproc. Returns true if the event should be swallowed.
45 virtual bool WndProc(UINT message, WPARAM wparam, LPARAM lparam); 52 virtual bool WndProc(UINT message, WPARAM wparam, LPARAM lparam);
46 53
47 void Paint(); 54 void Paint();
48 void Resize(LPARAM lparam); 55 void Resize(LPARAM lparam);
49 void MouseEvent(UINT message, WPARAM wparam, LPARAM lparam); 56 void MouseEvent(UINT message, WPARAM wparam, LPARAM lparam);
50 void WheelEvent(WPARAM wparam, LPARAM lparam); 57 void WheelEvent(WPARAM wparam, LPARAM lparam);
51 void KeyEvent(UINT message, WPARAM wparam, LPARAM lparam); 58 void KeyEvent(UINT message, WPARAM wparam, LPARAM lparam);
52 void CaptureLostEvent(); 59 void CaptureLostEvent();
53 void SetFocus(bool enable); 60 void SetFocus(bool enable);
54 61
62 static LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
63 #elif defined(OS_MACOSX)
64 // These need to be called from a non-subclass, so they need to be public.
65 public:
66 void Paint();
67 void Resize(const gfx::Rect& rect);
68 void MouseEvent(NSEvent *);
69 void WheelEvent(NSEvent *);
70 void KeyEvent(NSEvent *);
71 void SetFocus(bool enable);
72 protected:
73 #endif
74
55 void TrackMouseLeave(bool enable); 75 void TrackMouseLeave(bool enable);
56 void ResetScrollRect(); 76 void ResetScrollRect();
57 void PaintRect(const gfx::Rect& rect); 77 void PaintRect(const gfx::Rect& rect);
58 78
59 void set_painting(bool value) { 79 void set_painting(bool value) {
60 #ifndef NDEBUG 80 #ifndef NDEBUG
61 painting_ = value; 81 painting_ = value;
62 #endif 82 #endif
63 } 83 }
64 84
65 static LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); 85 gfx::ViewHandle view_;
66
67 HWND hwnd_;
68 WebWidget* webwidget_; 86 WebWidget* webwidget_;
69 scoped_ptr<gfx::PlatformCanvasWin> canvas_; 87 scoped_ptr<gfx::PlatformCanvas> canvas_;
70 88
71 // specifies the portion of the webwidget that needs painting 89 // specifies the portion of the webwidget that needs painting
72 gfx::Rect paint_rect_; 90 gfx::Rect paint_rect_;
73 91
74 // specifies the portion of the webwidget that needs scrolling 92 // specifies the portion of the webwidget that needs scrolling
75 gfx::Rect scroll_rect_; 93 gfx::Rect scroll_rect_;
76 int scroll_dx_; 94 int scroll_dx_;
77 int scroll_dy_; 95 int scroll_dy_;
78 96
79 bool track_mouse_leave_; 97 bool track_mouse_leave_;
80 98
81 #ifndef NDEBUG 99 #ifndef NDEBUG
82 bool painting_; 100 bool painting_;
83 #endif 101 #endif
84 }; 102 };
85 103
86 #endif // WEBKIT_TOOLS_TEST_SHELL_WEBWIDGET_HOST_H__ 104 #endif // WEBKIT_TOOLS_TEST_SHELL_WEBWIDGET_HOST_H_
87
OLDNEW
« no previous file with comments | « webkit/tools/test_shell/webview_host.cc ('k') | webkit/tools/test_shell/webwidget_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698