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

Side by Side Diff: chrome/browser/ui/views/frame/browser_non_client_frame_view_mus.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, 4 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_mus.h" 5 #include "chrome/browser/ui/views/frame/browser_non_client_frame_view_mus.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "chrome/app/chrome_command_ids.h" 9 #include "chrome/app/chrome_command_ids.h"
10 #include "chrome/browser/extensions/extension_util.h" 10 #include "chrome/browser/extensions/extension_util.h"
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 369
370 void BrowserNonClientFrameViewMus::TabStripMaxXChanged(TabStrip* tab_strip) { 370 void BrowserNonClientFrameViewMus::TabStripMaxXChanged(TabStrip* tab_strip) {
371 UpdateClientArea(); 371 UpdateClientArea();
372 } 372 }
373 373
374 void BrowserNonClientFrameViewMus::TabStripDeleted(TabStrip* tab_strip) { 374 void BrowserNonClientFrameViewMus::TabStripDeleted(TabStrip* tab_strip) {
375 tab_strip_->RemoveObserver(this); 375 tab_strip_->RemoveObserver(this);
376 tab_strip_ = nullptr; 376 tab_strip_ = nullptr;
377 } 377 }
378 378
379 bool BrowserNonClientFrameViewMus::DoesIntersectRect(
380 const views::View* target,
381 const gfx::Rect& rect) const {
382 CHECK_EQ(target, this);
383 if (!views::ViewTargeterDelegate::DoesIntersectRect(this, rect)) {
384 // |rect| is outside BrowserNonClientFrameViewMus's bounds.
385 return false;
386 }
387
388 if (!browser_view()->IsTabStripVisible()) {
389 // Claim |rect| if it is above the top of the topmost client area view.
390 return rect.y() < GetTopInset(false);
391 }
392
393 // Claim |rect| only if it is above the bottom of the tabstrip in a non-tab
394 // portion. In particular, the avatar label/button is left of the tabstrip and
395 // the window controls are right of the tabstrip.
396 TabStrip* tabstrip = browser_view()->tabstrip();
397 gfx::RectF rect_in_tabstrip_coords_f(rect);
398 View::ConvertRectToTarget(this, tabstrip, &rect_in_tabstrip_coords_f);
399 const gfx::Rect rect_in_tabstrip_coords =
400 gfx::ToEnclosingRect(rect_in_tabstrip_coords_f);
401 return (rect_in_tabstrip_coords.y() <= tabstrip->height()) &&
402 (!tabstrip->HitTestRect(rect_in_tabstrip_coords) ||
403 tabstrip->IsRectInWindowCaption(rect_in_tabstrip_coords));
404 }
405
379 int BrowserNonClientFrameViewMus::GetTabStripLeftInset() const { 406 int BrowserNonClientFrameViewMus::GetTabStripLeftInset() const {
380 const gfx::Insets insets(GetLayoutInsets(AVATAR_ICON)); 407 const gfx::Insets insets(GetLayoutInsets(AVATAR_ICON));
381 const int avatar_right = profile_indicator_icon() 408 const int avatar_right = profile_indicator_icon()
382 ? (insets.left() + GetIncognitoAvatarIcon().width()) 409 ? (insets.left() + GetIncognitoAvatarIcon().width())
383 : 0; 410 : 0;
384 return avatar_right + insets.right() + frame_values().normal_insets.left(); 411 return avatar_right + insets.right() + frame_values().normal_insets.left();
385 } 412 }
386 413
387 int BrowserNonClientFrameViewMus::GetTabStripRightInset() const { 414 int BrowserNonClientFrameViewMus::GetTabStripRightInset() const {
388 const int frame_right_insets = frame_values().normal_insets.right() + 415 const int frame_right_insets = frame_values().normal_insets.right() +
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
589 } 616 }
590 617
591 void BrowserNonClientFrameViewMus::PaintContentEdge(gfx::Canvas* canvas) { 618 void BrowserNonClientFrameViewMus::PaintContentEdge(gfx::Canvas* canvas) {
592 DCHECK(!UsePackagedAppHeaderStyle() && !UseWebAppHeaderStyle()); 619 DCHECK(!UsePackagedAppHeaderStyle() && !UseWebAppHeaderStyle());
593 const int bottom = frame_values().normal_insets.bottom(); 620 const int bottom = frame_values().normal_insets.bottom();
594 canvas->FillRect( 621 canvas->FillRect(
595 gfx::Rect(0, bottom, width(), kClientEdgeThickness), 622 gfx::Rect(0, bottom, width(), kClientEdgeThickness),
596 GetThemeProvider()->GetColor( 623 GetThemeProvider()->GetColor(
597 ThemeProperties::COLOR_TOOLBAR_BOTTOM_SEPARATOR)); 624 ThemeProperties::COLOR_TOOLBAR_BOTTOM_SEPARATOR));
598 } 625 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698