| 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/common/ash_layout_constants.h" | 9 #include "ash/common/ash_layout_constants.h" |
| 10 #include "ash/common/frame/caption_buttons/frame_caption_button_container_view.h
" | 10 #include "ash/common/frame/caption_buttons/frame_caption_button_container_view.h
" |
| (...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 if ((browser->profile()->GetProfileType() == Profile::INCOGNITO_PROFILE) || | 407 if ((browser->profile()->GetProfileType() == Profile::INCOGNITO_PROFILE) || |
| 408 chrome::MultiUserWindowManager::ShouldShowAvatar( | 408 chrome::MultiUserWindowManager::ShouldShowAvatar( |
| 409 browser_view()->GetNativeWindow())) { | 409 browser_view()->GetNativeWindow())) { |
| 410 UpdateProfileIndicatorIcon(); | 410 UpdateProfileIndicatorIcon(); |
| 411 } | 411 } |
| 412 } | 412 } |
| 413 | 413 |
| 414 /////////////////////////////////////////////////////////////////////////////// | 414 /////////////////////////////////////////////////////////////////////////////// |
| 415 // BrowserNonClientFrameViewAsh, private: | 415 // BrowserNonClientFrameViewAsh, private: |
| 416 | 416 |
| 417 // views::NonClientFrameView: | |
| 418 bool BrowserNonClientFrameViewAsh::DoesIntersectRect( | |
| 419 const views::View* target, | |
| 420 const gfx::Rect& rect) const { | |
| 421 CHECK_EQ(this, target); | |
| 422 if (!views::ViewTargeterDelegate::DoesIntersectRect(this, rect)) { | |
| 423 // |rect| is outside BrowserNonClientFrameViewAsh's bounds. | |
| 424 return false; | |
| 425 } | |
| 426 | |
| 427 if (!browser_view()->IsTabStripVisible()) { | |
| 428 // Claim |rect| if it is above the top of the topmost client area view. | |
| 429 return rect.y() < GetTopInset(false); | |
| 430 } | |
| 431 | |
| 432 // Claim |rect| only if it is above the bottom of the tabstrip in a non-tab | |
| 433 // portion. In particular, the avatar label/button is left of the tabstrip and | |
| 434 // the window controls are right of the tabstrip. | |
| 435 TabStrip* tabstrip = browser_view()->tabstrip(); | |
| 436 gfx::RectF rect_in_tabstrip_coords_f(rect); | |
| 437 View::ConvertRectToTarget(this, tabstrip, &rect_in_tabstrip_coords_f); | |
| 438 const gfx::Rect rect_in_tabstrip_coords( | |
| 439 gfx::ToEnclosingRect(rect_in_tabstrip_coords_f)); | |
| 440 return (rect_in_tabstrip_coords.y() <= tabstrip->height()) && | |
| 441 (!tabstrip->HitTestRect(rect_in_tabstrip_coords) || | |
| 442 tabstrip->IsRectInWindowCaption(rect_in_tabstrip_coords)); | |
| 443 } | |
| 444 | |
| 445 int BrowserNonClientFrameViewAsh::GetTabStripLeftInset() const { | 417 int BrowserNonClientFrameViewAsh::GetTabStripLeftInset() const { |
| 446 const gfx::Insets insets(GetLayoutInsets(AVATAR_ICON)); | 418 const gfx::Insets insets(GetLayoutInsets(AVATAR_ICON)); |
| 447 const int avatar_right = profile_indicator_icon() | 419 const int avatar_right = profile_indicator_icon() |
| 448 ? (insets.left() + GetIncognitoAvatarIcon().width()) | 420 ? (insets.left() + GetIncognitoAvatarIcon().width()) |
| 449 : 0; | 421 : 0; |
| 450 return avatar_right + insets.right(); | 422 return avatar_right + insets.right(); |
| 451 } | 423 } |
| 452 | 424 |
| 453 int BrowserNonClientFrameViewAsh::GetTabStripRightInset() const { | 425 int BrowserNonClientFrameViewAsh::GetTabStripRightInset() const { |
| 454 return kTabstripRightSpacing + | 426 return kTabstripRightSpacing + |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 589 // TODO(pkasting): The "2 *" part of this makes no sense to me. | 561 // TODO(pkasting): The "2 *" part of this makes no sense to me. |
| 590 canvas->TileImageInt(*right, 0, 0, w - (2 * kClientEdgeThickness) - img_w, | 562 canvas->TileImageInt(*right, 0, 0, w - (2 * kClientEdgeThickness) - img_w, |
| 591 img_y, img_w, img_h); | 563 img_y, img_w, img_h); |
| 592 | 564 |
| 593 // Toolbar/content separator. | 565 // Toolbar/content separator. |
| 594 toolbar_bounds.Inset(kClientEdgeThickness, h - kClientEdgeThickness, | 566 toolbar_bounds.Inset(kClientEdgeThickness, h - kClientEdgeThickness, |
| 595 kClientEdgeThickness, 0); | 567 kClientEdgeThickness, 0); |
| 596 canvas->FillRect(toolbar_bounds, separator_color); | 568 canvas->FillRect(toolbar_bounds, separator_color); |
| 597 } | 569 } |
| 598 } | 570 } |
| OLD | NEW |