diff options
author | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-20 20:38:08 +0000 |
---|---|---|
committer | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-20 20:38:08 +0000 |
commit | 6ff244f244f4e52e5e3dff32b0852bd5be80ec7d (patch) | |
tree | 009ce8d2f474444e740266b4e82f2c9a6cde58b2 /chrome/views/root_view_win.cc | |
parent | 577e30290cc9389a96303b8dd7543459dc50c236 (diff) | |
download | chromium_src-6ff244f244f4e52e5e3dff32b0852bd5be80ec7d.zip chromium_src-6ff244f244f4e52e5e3dff32b0852bd5be80ec7d.tar.gz chromium_src-6ff244f244f4e52e5e3dff32b0852bd5be80ec7d.tar.bz2 |
Fix the broken commit in r8250. The problem was that basictypes.h
wasn't getting included before a defined(OS_WIN) check.
Review URL: http://codereview.chromium.org/18414
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8308 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/views/root_view_win.cc')
-rw-r--r-- | chrome/views/root_view_win.cc | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/chrome/views/root_view_win.cc b/chrome/views/root_view_win.cc new file mode 100644 index 0000000..a843f1d --- /dev/null +++ b/chrome/views/root_view_win.cc @@ -0,0 +1,82 @@ +// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/views/root_view.h" + +#include "base/base_drag_source.h" +#include "chrome/common/drag_drop_types.h" +#include "chrome/views/root_view_drop_target.h" + +namespace views { + +RECT RootView::GetScheduledPaintRectConstrainedToSize() { + if (invalid_rect_.IsEmpty()) + return invalid_rect_.ToRECT(); + + return invalid_rect_.Intersect(GetLocalBounds(true)).ToRECT(); +} + +void RootView::UpdateCursor(const MouseEvent& e) { + View *v = GetViewForPoint(e.location()); + + if (v && v != this) { + gfx::Point l(e.location()); + View::ConvertPointToView(this, v, &l); + HCURSOR cursor = v->GetCursorForPoint(e.GetType(), l.x(), l.y()); + if (cursor) { + ::SetCursor(cursor); + return; + } + } + if (previous_cursor_) { + SetCursor(previous_cursor_); + } +} + +void RootView::OnPaint(HWND hwnd) { + RECT original_dirty_region = GetScheduledPaintRectConstrainedToSize(); + if (!IsRectEmpty(&original_dirty_region)) { + // Invoke InvalidateRect so that the dirty region of the window includes the + // region we need to paint. If we didn't do this and the region didn't + // include the dirty region, ProcessPaint would incorrectly mark everything + // as clean. This can happen if a WM_PAINT is generated by the system before + // the InvokeLater schedule by RootView is processed. + InvalidateRect(hwnd, &original_dirty_region, FALSE); + } + ChromeCanvasPaint canvas(hwnd); + if (!canvas.isEmpty()) { + const PAINTSTRUCT& ps = canvas.paintStruct(); + SchedulePaint(gfx::Rect(ps.rcPaint), false); + if (NeedsPainting(false)) + ProcessPaint(&canvas); + } +} + +bool RootView::GetAccessibleRole(VARIANT* role) { + DCHECK(role); + + role->vt = VT_I4; + role->lVal = ROLE_SYSTEM_APPLICATION; + return true; +} + +void RootView::StartDragForViewFromMouseEvent( + View* view, + IDataObject* data, + int operation) { + drag_view_ = view; + scoped_refptr<BaseDragSource> drag_source(new BaseDragSource); + DWORD effects; + DoDragDrop(data, drag_source, + DragDropTypes::DragOperationToDropEffect(operation), &effects); + // If the view is removed during the drag operation, drag_view_ is set to + // NULL. + if (drag_view_ == view) { + View* drag_view = drag_view_; + drag_view_ = NULL; + drag_view->OnDragDone(); + } +} + +} |