| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/bookmarks/bookmark_drop_info.h" |
| 6 |
| 7 #include "chrome/views/event.h" |
| 8 #include "chrome/views/view_constants.h" |
| 9 |
| 10 BookmarkDropInfo::BookmarkDropInfo(HWND hwnd, int top_margin) |
| 11 : source_operations_(0), |
| 12 is_control_down_(false), |
| 13 last_y_(0), |
| 14 drop_operation_(0), |
| 15 hwnd_(hwnd), |
| 16 top_margin_(top_margin), |
| 17 scroll_up_(false) { |
| 18 } |
| 19 |
| 20 void BookmarkDropInfo::Update(const views::DropTargetEvent& event) { |
| 21 source_operations_ = event.GetSourceOperations(); |
| 22 is_control_down_ = event.IsControlDown(); |
| 23 last_y_ = event.y(); |
| 24 |
| 25 RECT client_rect; |
| 26 GetClientRect(hwnd_, &client_rect); |
| 27 scroll_up_ = (last_y_ <= top_margin_ + views::kAutoscrollSize); |
| 28 bool scroll_down = (last_y_ >= client_rect.bottom - views::kAutoscrollSize); |
| 29 if (scroll_up_ || scroll_down) { |
| 30 if (!scroll_timer_.IsRunning()) { |
| 31 scroll_timer_.Start( |
| 32 base::TimeDelta::FromMilliseconds(views::kAutoscrollRowTimerMS), |
| 33 this, |
| 34 &BookmarkDropInfo::Scroll); |
| 35 } |
| 36 } else { |
| 37 scroll_timer_.Stop(); |
| 38 } |
| 39 } |
| 40 |
| 41 void BookmarkDropInfo::Scroll() { |
| 42 SendMessage(hwnd_, WM_VSCROLL, scroll_up_ ? SB_LINEUP : SB_LINEDOWN, NULL); |
| 43 Scrolled(); |
| 44 } |
| OLD | NEW |