diff options
author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-07 23:12:38 +0000 |
---|---|---|
committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-07 23:12:38 +0000 |
commit | c6f9cc2dda4fc4541d0ee4bc91491ed2a6ef57cd (patch) | |
tree | 19a05b1605a19a38391b0d4c5abc4082dcd7399d /chrome/browser/views/frame | |
parent | ad7b6319e6b005a4d289695f5c22013a0f9dd933 (diff) | |
download | chromium_src-c6f9cc2dda4fc4541d0ee4bc91491ed2a6ef57cd.zip chromium_src-c6f9cc2dda4fc4541d0ee4bc91491ed2a6ef57cd.tar.gz chromium_src-c6f9cc2dda4fc4541d0ee4bc91491ed2a6ef57cd.tar.bz2 |
Move all the stuff relating to detached tab dragging out of BrowserFrameWin and onto the TabStrip2 object. It was mostly cross platform anyway.Adds APIs to Widget that:- allow a Widget to be obtained for a given gfx::NativeView- allow native properties to be set on a Widget.Adds an API to Window that lets the caller convert the window's appearance into a lightly transparent transient looking thing for dragging.BUG=noneTEST=none
Review URL: http://codereview.chromium.org/149440
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31394 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views/frame')
-rw-r--r-- | chrome/browser/views/frame/browser_frame_win.cc | 76 | ||||
-rw-r--r-- | chrome/browser/views/frame/browser_frame_win.h | 17 |
2 files changed, 6 insertions, 87 deletions
diff --git a/chrome/browser/views/frame/browser_frame_win.cc b/chrome/browser/views/frame/browser_frame_win.cc index a732934..a72bc3a 100644 --- a/chrome/browser/views/frame/browser_frame_win.cc +++ b/chrome/browser/views/frame/browser_frame_win.cc @@ -14,7 +14,6 @@ #include "app/win_util.h" #include "chrome/browser/profile.h" #include "chrome/browser/browser_list.h" -#include "chrome/browser/dock_info.h" #include "chrome/browser/views/frame/browser_non_client_frame_view.h" #include "chrome/browser/views/frame/browser_root_view.h" #include "chrome/browser/views/frame/browser_view.h" @@ -43,10 +42,6 @@ BrowserFrame* BrowserFrame::Create(BrowserView* browser_view, BrowserFrameWin::BrowserFrameWin(BrowserView* browser_view, Profile* profile) : WindowWin(browser_view), browser_view_(browser_view), - saved_window_style_(0), - saved_window_ex_style_(0), - detached_drag_mode_(false), - drop_tabstrip_(NULL), root_view_(NULL), frame_initialized_(false), profile_(profile) { @@ -92,11 +87,6 @@ void BrowserFrameWin::UpdateThrobber(bool running) { } void BrowserFrameWin::ContinueDraggingDetachedTab() { - detached_drag_mode_ = true; - - // Set the frame to partially transparent. - UpdateWindowAlphaForTabDragging(detached_drag_mode_); - // Send the message directly, so that the window is positioned appropriately. SendMessage(GetNativeWindow(), WM_NCLBUTTONDOWN, HTCAPTION, MAKELPARAM(0, 0)); } @@ -146,26 +136,14 @@ void BrowserFrameWin::OnEndSession(BOOL ending, UINT logoff) { } void BrowserFrameWin::OnEnterSizeMove() { - drop_tabstrip_ = NULL; + if (TabStrip2::Enabled()) + browser_view_->tabstrip()->AsBrowserTabStrip()->DetachDragStarted(); browser_view_->WindowMoveOrResizeStarted(); } void BrowserFrameWin::OnExitSizeMove() { - if (TabStrip2::Enabled()) { - if (detached_drag_mode_) { - detached_drag_mode_ = false; - if (drop_tabstrip_) { - gfx::Point screen_point = views::Screen::GetCursorScreenPoint(); - BrowserTabStrip* tabstrip = - browser_view_->tabstrip()->AsBrowserTabStrip(); - gfx::Rect tsb = tabstrip->GetDraggedTabScreenBounds(screen_point); - drop_tabstrip_->AttachTab(tabstrip->DetachTab(0), screen_point, tsb); - } else { - UpdateWindowAlphaForTabDragging(detached_drag_mode_); - browser_view_->tabstrip()->AsBrowserTabStrip()->SendDraggedTabHome(); - } - } - } + if (TabStrip2::Enabled()) + browser_view_->tabstrip()->AsBrowserTabStrip()->DetachDragEnded(); WidgetWin::OnExitSizeMove(); } @@ -209,30 +187,8 @@ LRESULT BrowserFrameWin::OnNCHitTest(const CPoint& pt) { } void BrowserFrameWin::OnWindowPosChanged(WINDOWPOS* window_pos) { - if (TabStrip2::Enabled()) { - if (detached_drag_mode_) { - // TODO(beng): move all to BrowserTabStrip... - - // We check to see if the mouse cursor is in the magnetism zone of another - // visible TabStrip. If so, we should dock to it. - std::set<HWND> ignore_windows; - ignore_windows.insert(GetNativeWindow()); - - gfx::Point screen_point = views::Screen::GetCursorScreenPoint(); - HWND local_window = - DockInfo::GetLocalProcessWindowAtPoint(screen_point, ignore_windows); - if (local_window) { - BrowserView* browser_view = - BrowserView::GetBrowserViewForNativeWindow(local_window); - drop_tabstrip_ = browser_view->tabstrip()->AsBrowserTabStrip(); - if (TabStrip2::IsDragRearrange(drop_tabstrip_, screen_point)) { - ReleaseCapture(); - return; - } - } - drop_tabstrip_ = NULL; - } - } + if (TabStrip2::Enabled()) + browser_view_->tabstrip()->AsBrowserTabStrip()->DetachDragMoved(); // Windows lies to us about the position of the minimize button before a // window is visible. We use the position of the minimize button to place the @@ -319,23 +275,3 @@ void BrowserFrameWin::UpdateDWMFrame() { } DwmExtendFrameIntoClientArea(GetNativeView(), &margins); } - -void BrowserFrameWin::UpdateWindowAlphaForTabDragging(bool dragging) { - HWND frame_hwnd = GetNativeWindow(); - if (dragging) { - // Make the frame slightly transparent during the drag operation. - saved_window_style_ = ::GetWindowLong(frame_hwnd, GWL_STYLE); - saved_window_ex_style_ = ::GetWindowLong(frame_hwnd, GWL_EXSTYLE); - ::SetWindowLong(frame_hwnd, GWL_EXSTYLE, - saved_window_ex_style_ | WS_EX_LAYERED); - // Remove the captions tyle so the window doesn't have window controls for a - // more "transparent" look. - ::SetWindowLong(frame_hwnd, GWL_STYLE, - saved_window_style_ & ~WS_CAPTION); - SetLayeredWindowAttributes(frame_hwnd, RGB(0xFF, 0xFF, 0xFF), - kTabDragWindowAlpha, LWA_ALPHA); - } else { - ::SetWindowLong(frame_hwnd, GWL_STYLE, saved_window_style_); - ::SetWindowLong(frame_hwnd, GWL_EXSTYLE, saved_window_ex_style_); - } -} diff --git a/chrome/browser/views/frame/browser_frame_win.h b/chrome/browser/views/frame/browser_frame_win.h index 789795b..04dc35b 100644 --- a/chrome/browser/views/frame/browser_frame_win.h +++ b/chrome/browser/views/frame/browser_frame_win.h @@ -76,10 +76,6 @@ class BrowserFrameWin : public BrowserFrame, public views::WindowWin { // Updates the DWM with the frame bounds. void UpdateDWMFrame(); - // Update the window's pacity when entering and exiting detached dragging - // mode. - void UpdateWindowAlphaForTabDragging(bool dragging); - // The BrowserView is our ClientView. This is a pointer to it. BrowserView* browser_view_; @@ -95,19 +91,6 @@ class BrowserFrameWin : public BrowserFrame, public views::WindowWin { Profile* profile_; - // The window styles before we modified them for a tab dragging operation. - DWORD saved_window_style_; - DWORD saved_window_ex_style_; - - // True if the window is currently being moved in a detached tab drag - // operation. - bool detached_drag_mode_; - - // When this frame represents a detached tab being dragged, this is a TabStrip - // in another window that the tab being dragged would be docked to if the - // mouse were released, or NULL if there is no suitable TabStrip. - BrowserTabStrip* drop_tabstrip_; - DISALLOW_COPY_AND_ASSIGN(BrowserFrameWin); }; |