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 b3f6d43ad20c6f61957fb0dcda16fb95f3ca71a5..907b2fde4a33585307054d29af07a4552f7fdc83 100644 |
--- a/chrome/browser/ui/panels/panel_browser_view.cc |
+++ b/chrome/browser/ui/panels/panel_browser_view.cc |
@@ -462,11 +462,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; |
} |
@@ -528,21 +528,29 @@ bool PanelBrowserView::EndDragging(bool cancelled) { |
} |
void PanelBrowserView::SetPanelAppIconVisibility(bool visible) { |
+ // The panel should not show app icon in the desktop bar if it is in overflow. |
#if defined(OS_WIN) && !defined(USE_AURA) |
gfx::NativeWindow native_window = GetNativeHandle(); |
- ::ShowWindow(native_window, SW_HIDE); |
int style = ::GetWindowLong(native_window, GWL_EXSTYLE); |
+ int new_style = style; |
if (visible) |
- style &= (~WS_EX_TOOLWINDOW); |
+ new_style &= (~WS_EX_TOOLWINDOW); |
else |
- style |= WS_EX_TOOLWINDOW; |
- ::SetWindowLong(native_window, GWL_EXSTYLE, style); |
- ::ShowWindow(native_window, SW_SHOWNA); |
+ new_style |= WS_EX_TOOLWINDOW; |
+ if (style != new_style) { |
+ ::ShowWindow(native_window, SW_HIDE); |
+ ::SetWindowLong(native_window, GWL_EXSTYLE, new_style); |
+ ::ShowWindow(native_window, SW_SHOWNA); |
+ } |
#else |
NOTIMPLEMENTED(); |
#endif |
} |
+void PanelBrowserView::SetPanelAlwaysOnTop(bool on_top) { |
+ GetWidget()->SetAlwaysOnTop(on_top); |
+} |
+ |
// NativePanelTesting implementation. |
class NativePanelTestingWin : public NativePanelTesting { |
public: |
@@ -550,9 +558,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 +585,28 @@ NativePanelTestingWin::NativePanelTestingWin( |
} |
void NativePanelTestingWin::PressLeftMouseButtonTitlebar( |
- const gfx::Point& point) { |
- panel_browser_view_->OnTitlebarMousePressed(point); |
+ const gfx::Point& mouse_location) { |
+ // Convert from the screen coordinate system to the view's coordinate system |
+ // since OnTitlebarMouseDragged takes the point in the latter. |
+ gfx::Point mouse_location_in_screen_coordinates = mouse_location; |
+ views::View::ConvertPointToView(NULL, panel_browser_view_, |
+ &mouse_location_in_screen_coordinates); |
+ panel_browser_view_->OnTitlebarMousePressed( |
+ mouse_location_in_screen_coordinates); |
} |
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); |
- |
+void NativePanelTestingWin::DragTitlebar(const gfx::Point& mouse_location) { |
// Convert from the screen coordinate system to the view's coordinate system |
// since OnTitlebarMouseDragged takes the point in the latter. |
+ gfx::Point mouse_location_in_screen_coordinates = mouse_location; |
views::View::ConvertPointToView(NULL, panel_browser_view_, |
- &new_mouse_location); |
- panel_browser_view_->OnTitlebarMouseDragged(new_mouse_location); |
+ &mouse_location_in_screen_coordinates); |
+ panel_browser_view_->OnTitlebarMouseDragged( |
+ mouse_location_in_screen_coordinates); |
} |
void NativePanelTestingWin::CancelDragTitlebar() { |