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

Side by Side Diff: chrome/browser/ui/views/frame/opaque_browser_frame_view.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
« no previous file with comments | « chrome/browser/ui/views/frame/opaque_browser_frame_view.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/opaque_browser_frame_view.h" 5 #include "chrome/browser/ui/views/frame/opaque_browser_frame_view.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 #include "chrome/browser/themes/theme_properties.h" 8 #include "chrome/browser/themes/theme_properties.h"
9 #include "chrome/browser/themes/theme_service_factory.h" 9 #include "chrome/browser/themes/theme_service_factory.h"
10 #include "chrome/browser/ui/views/frame/browser_frame.h" 10 #include "chrome/browser/ui/views/frame/browser_frame.h"
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 void OpaqueBrowserFrameView::UpdateProfileIcons() { 448 void OpaqueBrowserFrameView::UpdateProfileIcons() {
449 if (browser_view()->IsRegularOrGuestSession()) 449 if (browser_view()->IsRegularOrGuestSession())
450 profile_switcher_.Update(AvatarButtonStyle::THEMED); 450 profile_switcher_.Update(AvatarButtonStyle::THEMED);
451 else 451 else
452 UpdateProfileIndicatorIcon(); 452 UpdateProfileIndicatorIcon();
453 } 453 }
454 454
455 /////////////////////////////////////////////////////////////////////////////// 455 ///////////////////////////////////////////////////////////////////////////////
456 // OpaqueBrowserFrameView, private: 456 // OpaqueBrowserFrameView, private:
457 457
458 // views::NonClientFrameView:
459 bool OpaqueBrowserFrameView::DoesIntersectRect(const views::View* target,
460 const gfx::Rect& rect) const {
461 CHECK_EQ(target, this);
462 if (!views::ViewTargeterDelegate::DoesIntersectRect(this, rect)) {
463 // |rect| is outside OpaqueBrowserFrameView's bounds.
464 return false;
465 }
466
467 // If the rect is outside the bounds of the client area, claim it.
468 gfx::RectF rect_in_client_view_coords_f(rect);
469 View::ConvertRectToTarget(this, frame()->client_view(),
470 &rect_in_client_view_coords_f);
471 gfx::Rect rect_in_client_view_coords = gfx::ToEnclosingRect(
472 rect_in_client_view_coords_f);
473 if (!frame()->client_view()->HitTestRect(rect_in_client_view_coords))
474 return true;
475
476 // Otherwise, claim |rect| only if it is above the bottom of the tabstrip in
477 // a non-tab portion.
478 TabStrip* tabstrip = browser_view()->tabstrip();
479 if (!tabstrip || !browser_view()->IsTabStripVisible())
480 return false;
481
482 gfx::RectF rect_in_tabstrip_coords_f(rect);
483 View::ConvertRectToTarget(this, tabstrip, &rect_in_tabstrip_coords_f);
484 gfx::Rect rect_in_tabstrip_coords = gfx::ToEnclosingRect(
485 rect_in_tabstrip_coords_f);
486 if (rect_in_tabstrip_coords.bottom() > tabstrip->GetLocalBounds().bottom()) {
487 // |rect| is below the tabstrip.
488 return false;
489 }
490
491 if (tabstrip->HitTestRect(rect_in_tabstrip_coords)) {
492 // Claim |rect| if it is in a non-tab portion of the tabstrip.
493 return tabstrip->IsRectInWindowCaption(rect_in_tabstrip_coords);
494 }
495
496 // We claim |rect| because it is above the bottom of the tabstrip, but
497 // not in the tabstrip itself. In particular, the avatar label/button is left
498 // of the tabstrip and the window controls are right of the tabstrip.
499 return true;
500 }
501
458 views::ImageButton* OpaqueBrowserFrameView::InitWindowCaptionButton( 502 views::ImageButton* OpaqueBrowserFrameView::InitWindowCaptionButton(
459 int normal_image_id, 503 int normal_image_id,
460 int hot_image_id, 504 int hot_image_id,
461 int pushed_image_id, 505 int pushed_image_id,
462 int mask_image_id, 506 int mask_image_id,
463 int accessibility_string_id, 507 int accessibility_string_id,
464 ViewID view_id) { 508 ViewID view_id) {
465 views::ImageButton* button = new views::ImageButton(this); 509 views::ImageButton* button = new views::ImageButton(this);
466 const ui::ThemeProvider* tp = frame()->GetThemeProvider(); 510 const ui::ThemeProvider* tp = frame()->GetThemeProvider();
467 button->SetImage(views::CustomButton::STATE_NORMAL, 511 button->SetImage(views::CustomButton::STATE_NORMAL,
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
764 gfx::Rect side(x, y, kClientEdgeThickness, h); 808 gfx::Rect side(x, y, kClientEdgeThickness, h);
765 canvas->FillRect(side, color); 809 canvas->FillRect(side, color);
766 if (draw_bottom) { 810 if (draw_bottom) {
767 canvas->FillRect(gfx::Rect(x, y + h, w + (2 * kClientEdgeThickness), 811 canvas->FillRect(gfx::Rect(x, y + h, w + (2 * kClientEdgeThickness),
768 kClientEdgeThickness), 812 kClientEdgeThickness),
769 color); 813 color);
770 } 814 }
771 side.Offset(w + kClientEdgeThickness, 0); 815 side.Offset(w + kClientEdgeThickness, 0);
772 canvas->FillRect(side, color); 816 canvas->FillRect(side, color);
773 } 817 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/frame/opaque_browser_frame_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698