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 "chrome/renderer/render_widget.h" | 5 #include "chrome/renderer/render_widget.h" |
6 | 6 |
7 #include "base/gfx/point.h" | 7 #include "base/gfx/point.h" |
8 #include "base/gfx/size.h" | 8 #include "base/gfx/size.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
11 #include "base/scoped_ptr.h" | 11 #include "base/scoped_ptr.h" |
12 #include "build/build_config.h" | 12 #include "build/build_config.h" |
13 #include "chrome/common/render_messages.h" | 13 #include "chrome/common/render_messages.h" |
14 #include "chrome/common/transport_dib.h" | 14 #include "chrome/common/transport_dib.h" |
15 #include "chrome/renderer/render_process.h" | 15 #include "chrome/renderer/render_process.h" |
16 #include "skia/ext/platform_canvas.h" | 16 #include "skia/ext/platform_canvas.h" |
17 #include "third_party/skia/include/core/SkShader.h" | 17 #include "third_party/skia/include/core/SkShader.h" |
| 18 #include "webkit/api/public/WebCursorInfo.h" |
18 #include "webkit/api/public/WebRect.h" | 19 #include "webkit/api/public/WebRect.h" |
19 #include "webkit/api/public/WebScreenInfo.h" | 20 #include "webkit/api/public/WebScreenInfo.h" |
20 #include "webkit/api/public/WebSize.h" | 21 #include "webkit/api/public/WebSize.h" |
21 | 22 |
22 #if defined(OS_POSIX) | 23 #if defined(OS_POSIX) |
23 #include "third_party/skia/include/core/SkPixelRef.h" | 24 #include "third_party/skia/include/core/SkPixelRef.h" |
24 #include "third_party/skia/include/core/SkMallocPixelRef.h" | 25 #include "third_party/skia/include/core/SkMallocPixelRef.h" |
25 #endif // defined(OS_POSIX) | 26 #endif // defined(OS_POSIX) |
26 | 27 |
27 #include "webkit/glue/webtextdirection.h" | 28 #include "webkit/glue/webtextdirection.h" |
28 #include "webkit/glue/webwidget.h" | 29 #include "webkit/glue/webwidget.h" |
29 | 30 |
| 31 using WebKit::WebCursorInfo; |
30 using WebKit::WebInputEvent; | 32 using WebKit::WebInputEvent; |
31 using WebKit::WebRect; | 33 using WebKit::WebRect; |
32 using WebKit::WebScreenInfo; | 34 using WebKit::WebScreenInfo; |
33 using WebKit::WebSize; | 35 using WebKit::WebSize; |
34 | 36 |
35 RenderWidget::RenderWidget(RenderThreadBase* render_thread, bool activatable) | 37 RenderWidget::RenderWidget(RenderThreadBase* render_thread, bool activatable) |
36 : routing_id_(MSG_ROUTING_NONE), | 38 : routing_id_(MSG_ROUTING_NONE), |
37 webwidget_(NULL), | 39 webwidget_(NULL), |
38 opener_id_(MSG_ROUTING_NONE), | 40 opener_id_(MSG_ROUTING_NONE), |
39 render_thread_(render_thread), | 41 render_thread_(render_thread), |
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
554 scroll_delta_.SetPoint(dx, dy); | 556 scroll_delta_.SetPoint(dx, dy); |
555 | 557 |
556 if (scroll_pending) | 558 if (scroll_pending) |
557 return; | 559 return; |
558 | 560 |
559 // Perform scrolling asynchronously since we need to call WebView::Paint | 561 // Perform scrolling asynchronously since we need to call WebView::Paint |
560 MessageLoop::current()->PostTask(FROM_HERE, NewRunnableMethod( | 562 MessageLoop::current()->PostTask(FROM_HERE, NewRunnableMethod( |
561 this, &RenderWidget::DoDeferredScroll)); | 563 this, &RenderWidget::DoDeferredScroll)); |
562 } | 564 } |
563 | 565 |
564 void RenderWidget::SetCursor(WebWidget* webwidget, const WebCursor& cursor) { | 566 void RenderWidget::SetCursor(WebWidget* webwidget, |
| 567 const WebCursorInfo& cursor_info) { |
| 568 // TODO(darin): Eliminate this temporary. |
| 569 WebCursor cursor(cursor_info); |
| 570 |
565 // Only send a SetCursor message if we need to make a change. | 571 // Only send a SetCursor message if we need to make a change. |
566 if (!current_cursor_.IsEqual(cursor)) { | 572 if (!current_cursor_.IsEqual(cursor)) { |
567 current_cursor_ = cursor; | 573 current_cursor_ = cursor; |
568 Send(new ViewHostMsg_SetCursor(routing_id_, cursor)); | 574 Send(new ViewHostMsg_SetCursor(routing_id_, cursor)); |
569 } | 575 } |
570 } | 576 } |
571 | 577 |
572 // We are supposed to get a single call to Show for a newly created RenderWidget | 578 // We are supposed to get a single call to Show for a newly created RenderWidget |
573 // that was created via RenderWidget::CreateWebView. So, we wait until this | 579 // that was created via RenderWidget::CreateWebView. So, we wait until this |
574 // point to dispatch the ShowWidget message. | 580 // point to dispatch the ShowWidget message. |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
848 | 854 |
849 if (i == plugin_window_moves_.size()) | 855 if (i == plugin_window_moves_.size()) |
850 plugin_window_moves_.push_back(move); | 856 plugin_window_moves_.push_back(move); |
851 } | 857 } |
852 | 858 |
853 WebScreenInfo RenderWidget::GetScreenInfo(WebWidget* webwidget) { | 859 WebScreenInfo RenderWidget::GetScreenInfo(WebWidget* webwidget) { |
854 WebScreenInfo results; | 860 WebScreenInfo results; |
855 Send(new ViewHostMsg_GetScreenInfo(routing_id_, host_window_, &results)); | 861 Send(new ViewHostMsg_GetScreenInfo(routing_id_, host_window_, &results)); |
856 return results; | 862 return results; |
857 } | 863 } |
OLD | NEW |