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

Side by Side Diff: webkit/tools/test_shell/webwidget_host_win.cc

Issue 6254011: Move UI-relevant Windows files to ui/base. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 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_win.cc ('k') | no next file » | 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/webwidget_host.h" 5 #include "webkit/tools/test_shell/webwidget_host.h"
6 6
7 #include "app/win/hwnd_util.h"
8 #include "base/logging.h" 7 #include "base/logging.h"
9 #include "gfx/rect.h" 8 #include "gfx/rect.h"
10 #include "skia/ext/platform_canvas.h" 9 #include "skia/ext/platform_canvas.h"
11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" 10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h"
12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPopupMenu.h" 11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPopupMenu.h"
13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h" 12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h"
14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSize.h" 13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSize.h"
15 #include "third_party/WebKit/Source/WebKit/chromium/public/win/WebInputEventFact ory.h" 14 #include "third_party/WebKit/Source/WebKit/chromium/public/win/WebInputEventFact ory.h"
16 #include "third_party/WebKit/Source/WebKit/chromium/public/win/WebScreenInfoFact ory.h" 15 #include "third_party/WebKit/Source/WebKit/chromium/public/win/WebScreenInfoFact ory.h"
16 #include "ui/base/win/hwnd_util.h"
17 #include "webkit/tools/test_shell/test_shell.h" 17 #include "webkit/tools/test_shell/test_shell.h"
18 18
19 using WebKit::WebInputEvent; 19 using WebKit::WebInputEvent;
20 using WebKit::WebInputEventFactory; 20 using WebKit::WebInputEventFactory;
21 using WebKit::WebKeyboardEvent; 21 using WebKit::WebKeyboardEvent;
22 using WebKit::WebMouseEvent; 22 using WebKit::WebMouseEvent;
23 using WebKit::WebMouseWheelEvent; 23 using WebKit::WebMouseWheelEvent;
24 using WebKit::WebPopupMenu; 24 using WebKit::WebPopupMenu;
25 using WebKit::WebScreenInfo; 25 using WebKit::WebScreenInfo;
26 using WebKit::WebScreenInfoFactory; 26 using WebKit::WebScreenInfoFactory;
(...skipping 18 matching lines...) Expand all
45 wcex.hCursor = LoadCursor(NULL, IDC_ARROW); 45 wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
46 wcex.lpszClassName = kWindowClassName; 46 wcex.lpszClassName = kWindowClassName;
47 RegisterClassEx(&wcex); 47 RegisterClassEx(&wcex);
48 registered_class = true; 48 registered_class = true;
49 } 49 }
50 50
51 host->view_ = CreateWindowEx(WS_EX_TOOLWINDOW, 51 host->view_ = CreateWindowEx(WS_EX_TOOLWINDOW,
52 kWindowClassName, kWindowClassName, WS_POPUP, 52 kWindowClassName, kWindowClassName, WS_POPUP,
53 0, 0, 0, 0, 53 0, 0, 0, 0,
54 parent_view, NULL, GetModuleHandle(NULL), NULL); 54 parent_view, NULL, GetModuleHandle(NULL), NULL);
55 app::win::SetWindowUserData(host->view_, host); 55 ui::SetWindowUserData(host->view_, host);
56 56
57 host->webwidget_ = WebPopupMenu::create(client); 57 host->webwidget_ = WebPopupMenu::create(client);
58 58
59 return host; 59 return host;
60 } 60 }
61 61
62 static WebWidgetHost* FromWindow(HWND view) { 62 static WebWidgetHost* FromWindow(HWND view) {
63 return reinterpret_cast<WebWidgetHost*>(app::win::GetWindowUserData(view)); 63 return reinterpret_cast<WebWidgetHost*>(ui::GetWindowUserData(view));
64 } 64 }
65 65
66 /*static*/ 66 /*static*/
67 LRESULT CALLBACK WebWidgetHost::WndProc(HWND hwnd, UINT message, WPARAM wparam, 67 LRESULT CALLBACK WebWidgetHost::WndProc(HWND hwnd, UINT message, WPARAM wparam,
68 LPARAM lparam) { 68 LPARAM lparam) {
69 WebWidgetHost* host = FromWindow(hwnd); 69 WebWidgetHost* host = FromWindow(hwnd);
70 if (host && !host->WndProc(message, wparam, lparam)) { 70 if (host && !host->WndProc(message, wparam, lparam)) {
71 switch (message) { 71 switch (message) {
72 case WM_DESTROY: 72 case WM_DESTROY:
73 delete host; 73 delete host;
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 WebWidgetHost::WebWidgetHost() 198 WebWidgetHost::WebWidgetHost()
199 : view_(NULL), 199 : view_(NULL),
200 webwidget_(NULL), 200 webwidget_(NULL),
201 track_mouse_leave_(false), 201 track_mouse_leave_(false),
202 scroll_dx_(0), 202 scroll_dx_(0),
203 scroll_dy_(0) { 203 scroll_dy_(0) {
204 set_painting(false); 204 set_painting(false);
205 } 205 }
206 206
207 WebWidgetHost::~WebWidgetHost() { 207 WebWidgetHost::~WebWidgetHost() {
208 app::win::SetWindowUserData(view_, 0); 208 ui::SetWindowUserData(view_, 0);
209 209
210 TrackMouseLeave(false); 210 TrackMouseLeave(false);
211 211
212 webwidget_->close(); 212 webwidget_->close();
213 } 213 }
214 214
215 bool WebWidgetHost::WndProc(UINT message, WPARAM wparam, LPARAM lparam) { 215 bool WebWidgetHost::WndProc(UINT message, WPARAM wparam, LPARAM lparam) {
216 switch (message) { 216 switch (message) {
217 case WM_ACTIVATE: 217 case WM_ACTIVATE:
218 if (wparam == WA_INACTIVE) { 218 if (wparam == WA_INACTIVE) {
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 void WebWidgetHost::PaintRect(const gfx::Rect& rect) { 371 void WebWidgetHost::PaintRect(const gfx::Rect& rect) {
372 #ifndef NDEBUG 372 #ifndef NDEBUG
373 DCHECK(!painting_); 373 DCHECK(!painting_);
374 #endif 374 #endif
375 DCHECK(canvas_.get()); 375 DCHECK(canvas_.get());
376 376
377 set_painting(true); 377 set_painting(true);
378 webwidget_->paint(canvas_.get(), rect); 378 webwidget_->paint(canvas_.get(), rect);
379 set_painting(false); 379 set_painting(false);
380 } 380 }
OLDNEW
« no previous file with comments | « webkit/tools/test_shell/webview_host_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698