| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/views/frame/browser_frame_win.h" | 5 #include "chrome/browser/views/frame/browser_frame_win.h" |
| 6 | 6 |
| 7 #include <dwmapi.h> | 7 #include <dwmapi.h> |
| 8 #include <shellapi.h> | 8 #include <shellapi.h> |
| 9 | 9 |
| 10 #include "app/resource_bundle.h" | 10 #include "app/resource_bundle.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 WindowWin::Init(NULL, gfx::Rect()); | 57 WindowWin::Init(NULL, gfx::Rect()); |
| 58 } | 58 } |
| 59 | 59 |
| 60 BrowserFrameWin::~BrowserFrameWin() { | 60 BrowserFrameWin::~BrowserFrameWin() { |
| 61 } | 61 } |
| 62 | 62 |
| 63 views::Window* BrowserFrameWin::GetWindow() { | 63 views::Window* BrowserFrameWin::GetWindow() { |
| 64 return this; | 64 return this; |
| 65 } | 65 } |
| 66 | 66 |
| 67 void BrowserFrameWin::TabStripCreated(TabStrip* tabstrip) { | 67 void BrowserFrameWin::TabStripCreated(TabStripWrapper* tabstrip) { |
| 68 root_view_->set_tabstrip(tabstrip); | 68 root_view_->set_tabstrip(tabstrip); |
| 69 } | 69 } |
| 70 | 70 |
| 71 int BrowserFrameWin::GetMinimizeButtonOffset() const { | 71 int BrowserFrameWin::GetMinimizeButtonOffset() const { |
| 72 TITLEBARINFOEX titlebar_info; | 72 TITLEBARINFOEX titlebar_info; |
| 73 titlebar_info.cbSize = sizeof(TITLEBARINFOEX); | 73 titlebar_info.cbSize = sizeof(TITLEBARINFOEX); |
| 74 SendMessage(GetNativeView(), WM_GETTITLEBARINFOEX, 0, (WPARAM)&titlebar_info); | 74 SendMessage(GetNativeView(), WM_GETTITLEBARINFOEX, 0, (WPARAM)&titlebar_info); |
| 75 | 75 |
| 76 CPoint minimize_button_corner(titlebar_info.rgrect[2].left, | 76 CPoint minimize_button_corner(titlebar_info.rgrect[2].left, |
| 77 titlebar_info.rgrect[2].top); | 77 titlebar_info.rgrect[2].top); |
| 78 MapWindowPoints(HWND_DESKTOP, GetNativeView(), &minimize_button_corner, 1); | 78 MapWindowPoints(HWND_DESKTOP, GetNativeView(), &minimize_button_corner, 1); |
| 79 | 79 |
| 80 return minimize_button_corner.x; | 80 return minimize_button_corner.x; |
| 81 } | 81 } |
| 82 | 82 |
| 83 gfx::Rect BrowserFrameWin::GetBoundsForTabStrip(TabStrip* tabstrip) const { | 83 gfx::Rect BrowserFrameWin::GetBoundsForTabStrip(TabStripWrapper* tabstrip) const
{ |
| 84 return browser_frame_view_->GetBoundsForTabStrip(tabstrip); | 84 return browser_frame_view_->GetBoundsForTabStrip(tabstrip); |
| 85 } | 85 } |
| 86 | 86 |
| 87 void BrowserFrameWin::UpdateThrobber(bool running) { | 87 void BrowserFrameWin::UpdateThrobber(bool running) { |
| 88 browser_frame_view_->UpdateThrobber(running); | 88 browser_frame_view_->UpdateThrobber(running); |
| 89 } | 89 } |
| 90 | 90 |
| 91 void BrowserFrameWin::ContinueDraggingDetachedTab() { | 91 void BrowserFrameWin::ContinueDraggingDetachedTab() { |
| 92 detached_drag_mode_ = true; | 92 detached_drag_mode_ = true; |
| 93 | 93 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 drop_tabstrip_ = NULL; | 132 drop_tabstrip_ = NULL; |
| 133 browser_view_->WindowMoveOrResizeStarted(); | 133 browser_view_->WindowMoveOrResizeStarted(); |
| 134 } | 134 } |
| 135 | 135 |
| 136 void BrowserFrameWin::OnExitSizeMove() { | 136 void BrowserFrameWin::OnExitSizeMove() { |
| 137 if (TabStrip2::Enabled()) { | 137 if (TabStrip2::Enabled()) { |
| 138 if (detached_drag_mode_) { | 138 if (detached_drag_mode_) { |
| 139 detached_drag_mode_ = false; | 139 detached_drag_mode_ = false; |
| 140 if (drop_tabstrip_) { | 140 if (drop_tabstrip_) { |
| 141 gfx::Point screen_point = views::Screen::GetCursorScreenPoint(); | 141 gfx::Point screen_point = views::Screen::GetCursorScreenPoint(); |
| 142 BrowserTabStrip* tabstrip = browser_view_->bts(); | 142 BrowserTabStrip* tabstrip = browser_view_->tabstrip()->AsBrowserTabStrip
(); |
| 143 gfx::Rect tsb = tabstrip->GetDraggedTabScreenBounds(screen_point); | 143 gfx::Rect tsb = tabstrip->GetDraggedTabScreenBounds(screen_point); |
| 144 drop_tabstrip_->AttachTab(tabstrip->DetachTab(0), screen_point, tsb); | 144 drop_tabstrip_->AttachTab(tabstrip->DetachTab(0), screen_point, tsb); |
| 145 } else { | 145 } else { |
| 146 UpdateWindowAlphaForTabDragging(detached_drag_mode_); | 146 UpdateWindowAlphaForTabDragging(detached_drag_mode_); |
| 147 browser_view_->bts()->SendDraggedTabHome(); | 147 browser_view_->tabstrip()->AsBrowserTabStrip()->SendDraggedTabHome(); |
| 148 } | 148 } |
| 149 } | 149 } |
| 150 } | 150 } |
| 151 WidgetWin::OnExitSizeMove(); | 151 WidgetWin::OnExitSizeMove(); |
| 152 } | 152 } |
| 153 | 153 |
| 154 void BrowserFrameWin::OnInitMenuPopup(HMENU menu, UINT position, | 154 void BrowserFrameWin::OnInitMenuPopup(HMENU menu, UINT position, |
| 155 BOOL is_system_menu) { | 155 BOOL is_system_menu) { |
| 156 browser_view_->PrepareToRunSystemMenu(menu); | 156 browser_view_->PrepareToRunSystemMenu(menu); |
| 157 } | 157 } |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 | 271 |
| 272 // We check to see if the mouse cursor is in the magnetism zone of another | 272 // We check to see if the mouse cursor is in the magnetism zone of another |
| 273 // visible TabStrip. If so, we should dock to it. | 273 // visible TabStrip. If so, we should dock to it. |
| 274 std::set<HWND> ignore_windows; | 274 std::set<HWND> ignore_windows; |
| 275 ignore_windows.insert(GetNativeWindow()); | 275 ignore_windows.insert(GetNativeWindow()); |
| 276 | 276 |
| 277 gfx::Point screen_point = views::Screen::GetCursorScreenPoint(); | 277 gfx::Point screen_point = views::Screen::GetCursorScreenPoint(); |
| 278 HWND local_window = | 278 HWND local_window = |
| 279 DockInfo::GetLocalProcessWindowAtPoint(screen_point, ignore_windows); | 279 DockInfo::GetLocalProcessWindowAtPoint(screen_point, ignore_windows); |
| 280 if (local_window) { | 280 if (local_window) { |
| 281 drop_tabstrip_ = | 281 BrowserView* browser_view = |
| 282 BrowserView::GetBrowserViewForNativeWindow(local_window)->bts(); | 282 BrowserView::GetBrowserViewForNativeWindow(local_window); |
| 283 drop_tabstrip_ = browser_view->tabstrip()->AsBrowserTabStrip(); |
| 283 if (TabStrip2::IsDragRearrange(drop_tabstrip_, screen_point)) { | 284 if (TabStrip2::IsDragRearrange(drop_tabstrip_, screen_point)) { |
| 284 ReleaseCapture(); | 285 ReleaseCapture(); |
| 285 return; | 286 return; |
| 286 } | 287 } |
| 287 } | 288 } |
| 288 drop_tabstrip_ = NULL; | 289 drop_tabstrip_ = NULL; |
| 289 } | 290 } |
| 290 } | 291 } |
| 291 | 292 |
| 292 // Windows lies to us about the position of the minimize button before a | 293 // Windows lies to us about the position of the minimize button before a |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 // more "transparent" look. | 373 // more "transparent" look. |
| 373 ::SetWindowLong(frame_hwnd, GWL_STYLE, | 374 ::SetWindowLong(frame_hwnd, GWL_STYLE, |
| 374 saved_window_style_ & ~WS_CAPTION); | 375 saved_window_style_ & ~WS_CAPTION); |
| 375 SetLayeredWindowAttributes(frame_hwnd, RGB(0xFF, 0xFF, 0xFF), | 376 SetLayeredWindowAttributes(frame_hwnd, RGB(0xFF, 0xFF, 0xFF), |
| 376 kTabDragWindowAlpha, LWA_ALPHA); | 377 kTabDragWindowAlpha, LWA_ALPHA); |
| 377 } else { | 378 } else { |
| 378 ::SetWindowLong(frame_hwnd, GWL_STYLE, saved_window_style_); | 379 ::SetWindowLong(frame_hwnd, GWL_STYLE, saved_window_style_); |
| 379 ::SetWindowLong(frame_hwnd, GWL_EXSTYLE, saved_window_ex_style_); | 380 ::SetWindowLong(frame_hwnd, GWL_EXSTYLE, saved_window_ex_style_); |
| 380 } | 381 } |
| 381 } | 382 } |
| OLD | NEW |