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/old_frames/xp_frame.h" | 5 #include "chrome/browser/views/old_frames/xp_frame.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/gfx/native_theme.h" | 10 #include "base/gfx/native_theme.h" |
(...skipping 1370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1381 // Convert from screen to window coordinates | 1381 // Convert from screen to window coordinates |
1382 p.x -= r.left; | 1382 p.x -= r.left; |
1383 p.y -= r.top; | 1383 p.y -= r.top; |
1384 | 1384 |
1385 if (!IsTabStripVisible() && | 1385 if (!IsTabStripVisible() && |
1386 ComputeResizeMode(p.x, p.y, r.Width(), r.Height()) == RM_UNDEFINED && | 1386 ComputeResizeMode(p.x, p.y, r.Width(), r.Height()) == RM_UNDEFINED && |
1387 root_view_.GetViewForPoint(p) == frame_view_) { | 1387 root_view_.GetViewForPoint(p) == frame_view_) { |
1388 return HTCAPTION; | 1388 return HTCAPTION; |
1389 } | 1389 } |
1390 | 1390 |
1391 CPoint tsp(p); | 1391 gfx::Point tsp(p); |
1392 ChromeViews::View::ConvertPointToView(&root_view_, tabstrip_, &tsp); | 1392 ChromeViews::View::ConvertPointToView(&root_view_, tabstrip_, &tsp); |
1393 | 1393 |
1394 // If the mouse is over the tabstrip. Check if we should move the window or | 1394 // If the mouse is over the tabstrip. Check if we should move the window or |
1395 // capture the mouse. | 1395 // capture the mouse. |
1396 if (tabstrip_->CanProcessInputEvents() && tabstrip_->HitTest(tsp)) { | 1396 if (tabstrip_->CanProcessInputEvents() && tabstrip_->HitTest(tsp.ToPOINT())) { |
1397 // The top few pixels of a tab strip are a dropshadow - as we're pretty | 1397 // The top few pixels of a tab strip are a dropshadow - as we're pretty |
1398 // starved of draggable area, let's give it to window dragging (this | 1398 // starved of draggable area, let's give it to window dragging (this |
1399 // also makes sense visually. | 1399 // also makes sense visually. |
1400 if (!IsZoomed() && tsp.y < kTabShadowSize) | 1400 if (!IsZoomed() && tsp.y() < kTabShadowSize) |
1401 return HTCAPTION; | 1401 return HTCAPTION; |
1402 | 1402 |
1403 ChromeViews::View* v = tabstrip_->GetViewForPoint(tsp); | 1403 ChromeViews::View* v = tabstrip_->GetViewForPoint(tsp.ToPOINT()); |
1404 // If there is not tab at this location, claim the hit was in the title | 1404 // If there is not tab at this location, claim the hit was in the title |
1405 // bar to get a move action. | 1405 // bar to get a move action. |
1406 if (v == tabstrip_) | 1406 if (v == tabstrip_) |
1407 return HTCAPTION; | 1407 return HTCAPTION; |
1408 | 1408 |
1409 // If the view under mouse is a tab, check if the tab strip allows tab | 1409 // If the view under mouse is a tab, check if the tab strip allows tab |
1410 // dragging or not. If not, return caption to get window dragging. | 1410 // dragging or not. If not, return caption to get window dragging. |
1411 if (v->GetClassName() == Tab::kTabClassName && | 1411 if (v->GetClassName() == Tab::kTabClassName && |
1412 !tabstrip_->HasAvailableDragActions()) | 1412 !tabstrip_->HasAvailableDragActions()) |
1413 return HTCAPTION; | 1413 return HTCAPTION; |
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1808 bool XPFrame::IsMaximized() { | 1808 bool XPFrame::IsMaximized() { |
1809 return !!IsZoomed(); | 1809 return !!IsZoomed(); |
1810 } | 1810 } |
1811 | 1811 |
1812 gfx::Rect XPFrame::GetBoundsForContentBounds(const gfx::Rect content_rect) { | 1812 gfx::Rect XPFrame::GetBoundsForContentBounds(const gfx::Rect content_rect) { |
1813 if (tab_contents_container_->x() == 0 && | 1813 if (tab_contents_container_->x() == 0 && |
1814 tab_contents_container_->width() == 0) { | 1814 tab_contents_container_->width() == 0) { |
1815 Layout(); | 1815 Layout(); |
1816 } | 1816 } |
1817 | 1817 |
1818 CPoint p(0, 0); | 1818 gfx::Point p; |
1819 ChromeViews::View::ConvertPointToViewContainer(tab_contents_container_, &p); | 1819 ChromeViews::View::ConvertPointToViewContainer(tab_contents_container_, &p); |
1820 CRect bounds; | 1820 CRect bounds; |
1821 GetBounds(&bounds, true); | 1821 GetBounds(&bounds, true); |
1822 | 1822 |
1823 gfx::Rect r; | 1823 gfx::Rect r; |
1824 r.set_x(content_rect.x() - p.x); | 1824 r.set_x(content_rect.x() - p.x()); |
1825 r.set_y(content_rect.y() - p.y); | 1825 r.set_y(content_rect.y() - p.y()); |
1826 r.set_width(p.x + content_rect.width() + | 1826 r.set_width(p.x() + content_rect.width() + |
1827 (bounds.Width() - (p.x + tab_contents_container_->width()))); | 1827 (bounds.Width() - (p.x() + tab_contents_container_->width()))); |
1828 r.set_height(p.y + content_rect.height() + | 1828 r.set_height(p.y() + content_rect.height() + |
1829 (bounds.Height() - (p.y + | 1829 (bounds.Height() - (p.y() + |
1830 tab_contents_container_->height()))); | 1830 tab_contents_container_->height()))); |
1831 return r; | 1831 return r; |
1832 } | 1832 } |
1833 | 1833 |
1834 void XPFrame::InfoBubbleShowing() { | 1834 void XPFrame::InfoBubbleShowing() { |
1835 ignore_ncactivate_ = true; | 1835 ignore_ncactivate_ = true; |
1836 paint_as_active_ = true; | 1836 paint_as_active_ = true; |
1837 } | 1837 } |
1838 | 1838 |
1839 void XPFrame::InfoBubbleClosing() { | 1839 void XPFrame::InfoBubbleClosing() { |
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2505 | 2505 |
2506 // Only do a layout if the current contents is non-null. We assume that if the | 2506 // Only do a layout if the current contents is non-null. We assume that if the |
2507 // contents is NULL, we're either being destroyed, or ShowTabContents is going | 2507 // contents is NULL, we're either being destroyed, or ShowTabContents is going |
2508 // to be invoked with a non-null TabContents again so that there is no need | 2508 // to be invoked with a non-null TabContents again so that there is no need |
2509 // in doing a layout now (and would result in extra work/invalidation on | 2509 // in doing a layout now (and would result in extra work/invalidation on |
2510 // tab switches). | 2510 // tab switches). |
2511 if (changed && current_tab) | 2511 if (changed && current_tab) |
2512 Layout(); | 2512 Layout(); |
2513 } | 2513 } |
2514 | 2514 |
OLD | NEW |