| 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 return (rect_in_tabstrip_coords.y() <= tabstrip->height()) && |
| 416 (!tabstrip->HitTestRect(rect_in_tabstrip_coords) || | 417 (!tabstrip->HitTestRect(rect_in_tabstrip_coords) || |
| 417 tabstrip->IsRectInWindowCaption(rect_in_tabstrip_coords)); | 418 tabstrip->IsRectInWindowCaption(rect_in_tabstrip_coords)); |
| 418 } | 419 } |
| 419 | 420 |
| 420 int BrowserNonClientFrameViewAsh::GetTabStripLeftInset() const { | 421 int BrowserNonClientFrameViewAsh::GetTabStripLeftInset() const { |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 565 // TODO(pkasting): The "2 *" part of this makes no sense to me. | 566 // TODO(pkasting): The "2 *" part of this makes no sense to me. |
| 566 canvas->TileImageInt(*right, 0, 0, w - (2 * kClientEdgeThickness) - img_w, | 567 canvas->TileImageInt(*right, 0, 0, w - (2 * kClientEdgeThickness) - img_w, |
| 567 img_y, img_w, img_h); | 568 img_y, img_w, img_h); |
| 568 | 569 |
| 569 // Toolbar/content separator. | 570 // Toolbar/content separator. |
| 570 toolbar_bounds.Inset(kClientEdgeThickness, h - kClientEdgeThickness, | 571 toolbar_bounds.Inset(kClientEdgeThickness, h - kClientEdgeThickness, |
| 571 kClientEdgeThickness, 0); | 572 kClientEdgeThickness, 0); |
| 572 canvas->FillRect(toolbar_bounds, separator_color); | 573 canvas->FillRect(toolbar_bounds, separator_color); |
| 573 } | 574 } |
| 574 } | 575 } |
| OLD | NEW |