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

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

Issue 1624803002: Don't allow pre-MD pre-Win 10 tabstrips to overlap the toolbar corner on glass. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 | « no previous file | 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/glass_browser_frame_view.h" 5 #include "chrome/browser/ui/views/frame/glass_browser_frame_view.h"
6 6
7 #include "base/prefs/pref_service.h" 7 #include "base/prefs/pref_service.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "base/win/windows_version.h" 9 #include "base/win/windows_version.h"
10 #include "chrome/app/chrome_command_ids.h" 10 #include "chrome/app/chrome_command_ids.h"
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 // or one pixel above the top of the screen in maximized mode. 539 // or one pixel above the top of the screen in maximized mode.
540 int button_y = frame()->IsMaximized() ? (FrameTopBorderHeight(false) - 1) : 1; 540 int button_y = frame()->IsMaximized() ? (FrameTopBorderHeight(false) - 1) : 1;
541 new_avatar_button()->SetBounds( 541 new_avatar_button()->SetBounds(
542 button_x, 542 button_x,
543 button_y, 543 button_y,
544 label_size.width(), 544 label_size.width(),
545 gfx::win::GetSystemMetricsInDIP(SM_CYMENUSIZE) + 1); 545 gfx::win::GetSystemMetricsInDIP(SM_CYMENUSIZE) + 1);
546 } 546 }
547 547
548 void GlassBrowserFrameView::LayoutIncognitoIcon() { 548 void GlassBrowserFrameView::LayoutIncognitoIcon() {
549 const bool md = ui::MaterialDesignController::IsModeMaterial();
549 const gfx::Insets insets(GetLayoutInsets(AVATAR_ICON)); 550 const gfx::Insets insets(GetLayoutInsets(AVATAR_ICON));
550 gfx::Size size; 551 gfx::Size size;
551 // During startup it's possible to reach here before the browser view has been 552 // During startup it's possible to reach here before the browser view has been
552 // added to the view hierarchy. In this case it won't have a widget and thus 553 // added to the view hierarchy. In this case it won't have a widget and thus
553 // can't access the theme provider, which is required to get the incognito 554 // can't access the theme provider, which is required to get the incognito
554 // icon. Use an empty size in this case, which will still place the tabstrip 555 // icon. Use an empty size in this case, which will still place the tabstrip
555 // at the correct coordinates for a non-incognito window. We should get 556 // at the correct coordinates for a non-incognito window. We should get
556 // another layout call after the browser view has a widget anyway. 557 // another layout call after the browser view has a widget anyway.
557 if (browser_view()->GetWidget()) 558 if (browser_view()->GetWidget())
558 size = browser_view()->GetOTRAvatarIcon().size(); 559 size = browser_view()->GetOTRAvatarIcon().size();
559 int x = NonClientBorderThickness(false); 560 int x = NonClientBorderThickness(false);
560 // In RTL, the icon needs to start after the caption buttons. 561 // In RTL, the icon needs to start after the caption buttons.
561 if (base::i18n::IsRTL()) { 562 if (base::i18n::IsRTL()) {
562 x = width() - frame()->GetMinimizeButtonOffset() + 563 x = width() - frame()->GetMinimizeButtonOffset() +
563 (new_avatar_button() ? 564 (new_avatar_button() ?
564 (new_avatar_button()->width() + kNewAvatarButtonOffset) : 0); 565 (new_avatar_button()->width() + kNewAvatarButtonOffset) : 0);
566 } else if (!md && !avatar_button() &&
567 (base::win::GetVersion() < base::win::VERSION_WIN10)) {
568 // In non-MD before Win 10, the toolbar has a rounded corner that we don't
569 // want the tabstrip to overlap.
570 x += browser_view()->GetToolbarBounds().x() - kContentEdgeShadowThickness +
571 GetThemeProvider()->GetImageSkiaNamed(
572 IDR_CONTENT_TOP_LEFT_CORNER)->width();
565 } 573 }
566 const int bottom = GetTopInset(false) + browser_view()->GetTabStripHeight() - 574 const int bottom = GetTopInset(false) + browser_view()->GetTabStripHeight() -
567 insets.bottom(); 575 insets.bottom();
568 const int y = (ui::MaterialDesignController::IsModeMaterial() || 576 const int y = (md || !frame()->IsMaximized()) ?
569 !frame()->IsMaximized()) ?
570 (bottom - size.height()) : FrameTopBorderHeight(false); 577 (bottom - size.height()) : FrameTopBorderHeight(false);
571 incognito_bounds_.SetRect(x + (avatar_button() ? insets.left() : 0), y, 578 incognito_bounds_.SetRect(x + (avatar_button() ? insets.left() : 0), y,
572 avatar_button() ? size.width() : 0, bottom - y); 579 avatar_button() ? size.width() : 0, bottom - y);
573 if (avatar_button()) 580 if (avatar_button())
574 avatar_button()->SetBoundsRect(incognito_bounds_); 581 avatar_button()->SetBoundsRect(incognito_bounds_);
575 } 582 }
576 583
577 void GlassBrowserFrameView::LayoutClientView() { 584 void GlassBrowserFrameView::LayoutClientView() {
578 client_view_bounds_ = CalculateClientAreaBounds(); 585 client_view_bounds_ = CalculateClientAreaBounds();
579 } 586 }
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
674 static bool initialized = false; 681 static bool initialized = false;
675 if (!initialized) { 682 if (!initialized) {
676 for (int i = 0; i < kThrobberIconCount; ++i) { 683 for (int i = 0; i < kThrobberIconCount; ++i) {
677 throbber_icons_[i] = 684 throbber_icons_[i] =
678 ui::LoadThemeIconFromResourcesDataDLL(IDI_THROBBER_01 + i); 685 ui::LoadThemeIconFromResourcesDataDLL(IDI_THROBBER_01 + i);
679 DCHECK(throbber_icons_[i]); 686 DCHECK(throbber_icons_[i]);
680 } 687 }
681 initialized = true; 688 initialized = true;
682 } 689 }
683 } 690 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698