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

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

Issue 9546001: Support detaching/attaching panels via inter-strip drags. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix per feedback Created 8 years, 10 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 b3f6d43ad20c6f61957fb0dcda16fb95f3ca71a5..f35e3bb8899e64674003ed9cfd8ebd9407e2ce38 100644
--- a/chrome/browser/ui/panels/panel_browser_view.cc
+++ b/chrome/browser/ui/panels/panel_browser_view.cc
@@ -428,14 +428,10 @@ PanelBrowserFrameView* PanelBrowserView::GetFrameView() const {
}
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_);
-
mouse_pressed_ = true;
mouse_pressed_time_ = base::TimeTicks::Now();
mouse_dragging_state_ = NO_DRAGGING;
+ mouse_location_ = location;
return true;
}
@@ -447,11 +443,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_);
int delta_x = mouse_location_.x() - last_mouse_location.x();
int delta_y = mouse_location_.y() - last_mouse_location.y();
@@ -462,11 +454,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 +520,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 +550,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 +577,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() {

Powered by Google App Engine
This is Rietveld 408576698