Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(201)

Side by Side Diff: chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.cc

Issue 2273863002: Revert of Refactor DoesIntersectRect into BrowserNonClientFrameView. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
417 int BrowserNonClientFrameViewAsh::GetTabStripLeftInset() const { 445 int BrowserNonClientFrameViewAsh::GetTabStripLeftInset() const {
418 const gfx::Insets insets(GetLayoutInsets(AVATAR_ICON)); 446 const gfx::Insets insets(GetLayoutInsets(AVATAR_ICON));
419 const int avatar_right = profile_indicator_icon() 447 const int avatar_right = profile_indicator_icon()
420 ? (insets.left() + GetIncognitoAvatarIcon().width()) 448 ? (insets.left() + GetIncognitoAvatarIcon().width())
421 : 0; 449 : 0;
422 return avatar_right + insets.right(); 450 return avatar_right + insets.right();
423 } 451 }
424 452
425 int BrowserNonClientFrameViewAsh::GetTabStripRightInset() const { 453 int BrowserNonClientFrameViewAsh::GetTabStripRightInset() const {
426 return kTabstripRightSpacing + 454 return kTabstripRightSpacing +
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
561 // TODO(pkasting): The "2 *" part of this makes no sense to me. 589 // TODO(pkasting): The "2 *" part of this makes no sense to me.
562 canvas->TileImageInt(*right, 0, 0, w - (2 * kClientEdgeThickness) - img_w, 590 canvas->TileImageInt(*right, 0, 0, w - (2 * kClientEdgeThickness) - img_w,
563 img_y, img_w, img_h); 591 img_y, img_w, img_h);
564 592
565 // Toolbar/content separator. 593 // Toolbar/content separator.
566 toolbar_bounds.Inset(kClientEdgeThickness, h - kClientEdgeThickness, 594 toolbar_bounds.Inset(kClientEdgeThickness, h - kClientEdgeThickness,
567 kClientEdgeThickness, 0); 595 kClientEdgeThickness, 0);
568 canvas->FillRect(toolbar_bounds, separator_color); 596 canvas->FillRect(toolbar_bounds, separator_color);
569 } 597 }
570 } 598 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698