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

Unified Diff: chrome/browser/ui/panels/panel_browser_view.cc

Issue 9616037: Change panel drag related methods to use mouse location in screen coordinates. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Patch to reland Created 8 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/panels/panel_browser_view.cc
diff --git a/chrome/browser/ui/panels/panel_browser_view.cc b/chrome/browser/ui/panels/panel_browser_view.cc
index 9873a24b7b06df08190efd61f66d09695053000d..92daaa3b372e838fc27f89b9780dc515e1461371 100644
--- a/chrome/browser/ui/panels/panel_browser_view.cc
+++ b/chrome/browser/ui/panels/panel_browser_view.cc
@@ -427,19 +427,17 @@ PanelBrowserFrameView* PanelBrowserView::GetFrameView() const {
return static_cast<PanelBrowserFrameView*>(frame()->GetFrameView());
}
-bool PanelBrowserView::OnTitlebarMousePressed(const gfx::Point& location) {
- // |location| is in the view's coordinate system. Convert it to the screen
- // coordinate system.
- mouse_location_ = location;
- views::View::ConvertPointToScreen(this, &mouse_location_);
-
+bool PanelBrowserView::OnTitlebarMousePressed(
+ const gfx::Point& mouse_location) {
mouse_pressed_ = true;
mouse_pressed_time_ = base::TimeTicks::Now();
mouse_dragging_state_ = NO_DRAGGING;
+ mouse_location_ = mouse_location;
return true;
}
-bool PanelBrowserView::OnTitlebarMouseDragged(const gfx::Point& location) {
+bool PanelBrowserView::OnTitlebarMouseDragged(
+ const gfx::Point& mouse_location) {
if (!mouse_pressed_)
return false;
@@ -447,11 +445,7 @@ bool PanelBrowserView::OnTitlebarMouseDragged(const gfx::Point& location) {
return true;
gfx::Point last_mouse_location = mouse_location_;
-
- // |location| is in the view's coordinate system. Convert it to the screen
- // coordinate system.
- mouse_location_ = location;
- views::View::ConvertPointToScreen(this, &mouse_location_);
+ mouse_location_ = mouse_location;
int delta_x = mouse_location_.x() - last_mouse_location.x();
int delta_y = mouse_location_.y() - last_mouse_location.y();
@@ -462,11 +456,11 @@ bool PanelBrowserView::OnTitlebarMouseDragged(const gfx::Point& location) {
old_focused_view_ = GetFocusManager()->GetFocusedView();
GetFocusManager()->SetFocusedView(GetFrameView());
- panel_->manager()->StartDragging(panel_.get());
+ panel_->manager()->StartDragging(panel_.get(), last_mouse_location);
mouse_dragging_state_ = DRAGGING_STARTED;
}
if (mouse_dragging_state_ == DRAGGING_STARTED)
- panel_->manager()->Drag(delta_x, delta_y);
+ panel_->manager()->Drag(mouse_location_);
return true;
}
@@ -550,9 +544,9 @@ class NativePanelTestingWin : public NativePanelTesting {
private:
virtual void PressLeftMouseButtonTitlebar(
- const gfx::Point& point) OVERRIDE;
+ const gfx::Point& mouse_location) OVERRIDE;
virtual void ReleaseMouseButtonTitlebar() OVERRIDE;
- virtual void DragTitlebar(int delta_x, int delta_y) OVERRIDE;
+ virtual void DragTitlebar(const gfx::Point& mouse_location) OVERRIDE;
virtual void CancelDragTitlebar() OVERRIDE;
virtual void FinishDragTitlebar() OVERRIDE;
virtual bool VerifyDrawingAttention() const OVERRIDE;
@@ -577,23 +571,16 @@ NativePanelTestingWin::NativePanelTestingWin(
}
void NativePanelTestingWin::PressLeftMouseButtonTitlebar(
- const gfx::Point& point) {
- panel_browser_view_->OnTitlebarMousePressed(point);
+ const gfx::Point& mouse_location) {
+ panel_browser_view_->OnTitlebarMousePressed(mouse_location);
}
void NativePanelTestingWin::ReleaseMouseButtonTitlebar() {
panel_browser_view_->OnTitlebarMouseReleased();
}
-void NativePanelTestingWin::DragTitlebar(int delta_x, int delta_y) {
- gfx::Point new_mouse_location = panel_browser_view_->mouse_location_;
- new_mouse_location.Offset(delta_x, delta_y);
-
- // Convert from the screen coordinate system to the view's coordinate system
- // since OnTitlebarMouseDragged takes the point in the latter.
- views::View::ConvertPointToView(NULL, panel_browser_view_,
- &new_mouse_location);
- panel_browser_view_->OnTitlebarMouseDragged(new_mouse_location);
+void NativePanelTestingWin::DragTitlebar(const gfx::Point& mouse_location) {
+ panel_browser_view_->OnTitlebarMouseDragged(mouse_location);
}
void NativePanelTestingWin::CancelDragTitlebar() {
« no previous file with comments | « chrome/browser/ui/panels/panel_browser_view.h ('k') | chrome/browser/ui/panels/panel_browser_window_cocoa.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698