Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/ui/views/frame/browser_non_client_frame_view_ash.h" | 5 #include "chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "ash/ash_layout_constants.h" | 9 #include "ash/ash_layout_constants.h" |
| 10 #include "ash/frame/caption_buttons/frame_caption_button_container_view.h" | 10 #include "ash/frame/caption_buttons/frame_caption_button_container_view.h" |
| (...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 393 // views::NonClientFrameView: | 393 // views::NonClientFrameView: |
| 394 bool BrowserNonClientFrameViewAsh::DoesIntersectRect( | 394 bool BrowserNonClientFrameViewAsh::DoesIntersectRect( |
| 395 const views::View* target, | 395 const views::View* target, |
| 396 const gfx::Rect& rect) const { | 396 const gfx::Rect& rect) const { |
| 397 CHECK_EQ(this, target); | 397 CHECK_EQ(this, target); |
| 398 if (!views::ViewTargeterDelegate::DoesIntersectRect(this, rect)) { | 398 if (!views::ViewTargeterDelegate::DoesIntersectRect(this, rect)) { |
| 399 // |rect| is outside BrowserNonClientFrameViewAsh's bounds. | 399 // |rect| is outside BrowserNonClientFrameViewAsh's bounds. |
| 400 return false; | 400 return false; |
| 401 } | 401 } |
| 402 | 402 |
| 403 TabStrip* tabstrip = browser_view()->tabstrip(); | 403 if (!browser_view()->IsTabStripVisible()) { |
| 404 if (!tabstrip || !browser_view()->IsTabStripVisible()) { | |
| 405 // Claim |rect| if it is above the top of the topmost client area view. | 404 // Claim |rect| if it is above the top of the topmost client area view. |
| 406 return rect.y() < GetTopInset(false); | 405 return rect.y() < GetTopInset(false); |
| 407 } | 406 } |
| 408 | 407 |
| 409 // Claim |rect| if it is above the bottom of the tabstrip in a non-tab | 408 // Claim |rect| only if it is above the bottom of the tabstrip in a non-tab |
| 410 // portion. | 409 // portion. In particular, the avatar label/button is left of the tabstrip and |
| 410 // the window controls are right of the tabstrip. | |
| 411 TabStrip* tabstrip = browser_view()->tabstrip(); | |
| 411 gfx::RectF rect_in_tabstrip_coords_f(rect); | 412 gfx::RectF rect_in_tabstrip_coords_f(rect); |
| 412 View::ConvertRectToTarget(this, tabstrip, &rect_in_tabstrip_coords_f); | 413 View::ConvertRectToTarget(this, tabstrip, &rect_in_tabstrip_coords_f); |
| 413 const gfx::Rect rect_in_tabstrip_coords( | 414 const gfx::Rect rect_in_tabstrip_coords( |
| 414 gfx::ToEnclosingRect(rect_in_tabstrip_coords_f)); | 415 gfx::ToEnclosingRect(rect_in_tabstrip_coords_f)); |
| 415 return (rect_in_tabstrip_coords.y() <= tabstrip->height()) && | 416 if (rect_in_tabstrip_coords.y() > tabstrip->height()) { |
| 416 (!tabstrip->HitTestRect(rect_in_tabstrip_coords) || | 417 // |rect| is entirely below the tabstrip. |
|
Peter Kasting
2016/03/14 23:04:42
Nit: To me this comment basically restates the cod
tdanderson
2016/03/15 15:51:42
Done.
| |
| 417 tabstrip->IsRectInWindowCaption(rect_in_tabstrip_coords)); | 418 return false; |
| 419 } | |
| 420 | |
| 421 return !tabstrip->HitTestRect(rect_in_tabstrip_coords) || | |
| 422 tabstrip->IsRectInWindowCaption(rect_in_tabstrip_coords); | |
| 418 } | 423 } |
| 419 | 424 |
| 420 int BrowserNonClientFrameViewAsh::GetTabStripLeftInset() const { | 425 int BrowserNonClientFrameViewAsh::GetTabStripLeftInset() const { |
| 421 const gfx::Insets insets(GetLayoutInsets(AVATAR_ICON)); | 426 const gfx::Insets insets(GetLayoutInsets(AVATAR_ICON)); |
| 422 const int avatar_right = | 427 const int avatar_right = |
| 423 avatar_button() ? (insets.left() + GetOTRAvatarIcon().width()) : 0; | 428 avatar_button() ? (insets.left() + GetOTRAvatarIcon().width()) : 0; |
| 424 return avatar_right + insets.right(); | 429 return avatar_right + insets.right(); |
| 425 } | 430 } |
| 426 | 431 |
| 427 int BrowserNonClientFrameViewAsh::GetTabStripRightInset() const { | 432 int BrowserNonClientFrameViewAsh::GetTabStripRightInset() const { |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 565 // TODO(pkasting): The "2 *" part of this makes no sense to me. | 570 // TODO(pkasting): The "2 *" part of this makes no sense to me. |
| 566 canvas->TileImageInt(*right, 0, 0, w - (2 * kClientEdgeThickness) - img_w, | 571 canvas->TileImageInt(*right, 0, 0, w - (2 * kClientEdgeThickness) - img_w, |
| 567 img_y, img_w, img_h); | 572 img_y, img_w, img_h); |
| 568 | 573 |
| 569 // Toolbar/content separator. | 574 // Toolbar/content separator. |
| 570 toolbar_bounds.Inset(kClientEdgeThickness, h - kClientEdgeThickness, | 575 toolbar_bounds.Inset(kClientEdgeThickness, h - kClientEdgeThickness, |
| 571 kClientEdgeThickness, 0); | 576 kClientEdgeThickness, 0); |
| 572 canvas->FillRect(toolbar_bounds, separator_color); | 577 canvas->FillRect(toolbar_bounds, separator_color); |
| 573 } | 578 } |
| 574 } | 579 } |
| OLD | NEW |