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

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

Issue 2555623002: Last round of cleaning up MD layout constants. (Closed)
Patch Set: pkasting review, remove debug code, rebase Created 4 years 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 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 chrome::MultiUserWindowManager::ShouldShowAvatar( 401 chrome::MultiUserWindowManager::ShouldShowAvatar(
402 browser_view()->GetNativeWindow())) { 402 browser_view()->GetNativeWindow())) {
403 UpdateProfileIndicatorIcon(); 403 UpdateProfileIndicatorIcon();
404 } 404 }
405 } 405 }
406 406
407 /////////////////////////////////////////////////////////////////////////////// 407 ///////////////////////////////////////////////////////////////////////////////
408 // BrowserNonClientFrameViewAsh, private: 408 // BrowserNonClientFrameViewAsh, private:
409 409
410 int BrowserNonClientFrameViewAsh::GetTabStripLeftInset() const { 410 int BrowserNonClientFrameViewAsh::GetTabStripLeftInset() const {
411 const int pad = GetLayoutConstant(AVATAR_ICON_PADDING);
412 const int avatar_right = 411 const int avatar_right =
413 profile_indicator_icon() ? (pad + GetIncognitoAvatarIcon().width()) : 0; 412 profile_indicator_icon()
414 return avatar_right + pad; 413 ? (kAvatarIconPadding + GetIncognitoAvatarIcon().width())
414 : 0;
415 return avatar_right + kAvatarIconPadding;
415 } 416 }
416 417
417 int BrowserNonClientFrameViewAsh::GetTabStripRightInset() const { 418 int BrowserNonClientFrameViewAsh::GetTabStripRightInset() const {
418 return kTabstripRightSpacing + 419 return kTabstripRightSpacing +
419 caption_button_container_->GetPreferredSize().width(); 420 caption_button_container_->GetPreferredSize().width();
420 } 421 }
421 422
422 bool BrowserNonClientFrameViewAsh::UseImmersiveLightbarHeaderStyle() const { 423 bool BrowserNonClientFrameViewAsh::UseImmersiveLightbarHeaderStyle() const {
423 const ImmersiveModeController* const immersive_controller = 424 const ImmersiveModeController* const immersive_controller =
424 browser_view()->immersive_mode_controller(); 425 browser_view()->immersive_mode_controller();
(...skipping 16 matching lines...) Expand all
441 } 442 }
442 443
443 void BrowserNonClientFrameViewAsh::LayoutProfileIndicatorIcon() { 444 void BrowserNonClientFrameViewAsh::LayoutProfileIndicatorIcon() {
444 DCHECK(profile_indicator_icon()); 445 DCHECK(profile_indicator_icon());
445 #if !defined(OS_CHROMEOS) 446 #if !defined(OS_CHROMEOS)
446 // ChromeOS shows avatar on V1 app. 447 // ChromeOS shows avatar on V1 app.
447 DCHECK(browser_view()->IsTabStripVisible()); 448 DCHECK(browser_view()->IsTabStripVisible());
448 #endif 449 #endif
449 450
450 const gfx::ImageSkia incognito_icon = GetIncognitoAvatarIcon(); 451 const gfx::ImageSkia incognito_icon = GetIncognitoAvatarIcon();
451 const int pad = GetLayoutConstant(AVATAR_ICON_PADDING); 452 const int avatar_bottom = GetTopInset(false) +
452 const int avatar_bottom = 453 browser_view()->GetTabStripHeight() -
453 GetTopInset(false) + browser_view()->GetTabStripHeight() - pad; 454 kAvatarIconPadding;
454 int avatar_y = avatar_bottom - incognito_icon.height(); 455 int avatar_y = avatar_bottom - incognito_icon.height();
455 456
456 // Hide the incognito icon in immersive fullscreen when the tab light bar is 457 // Hide the incognito icon in immersive fullscreen when the tab light bar is
457 // visible because the header is too short for the icognito icon to be 458 // visible because the header is too short for the icognito icon to be
458 // recognizable. 459 // recognizable.
459 const bool avatar_visible = !UseImmersiveLightbarHeaderStyle(); 460 const bool avatar_visible = !UseImmersiveLightbarHeaderStyle();
460 const int avatar_height = avatar_visible ? (avatar_bottom - avatar_y) : 0; 461 const int avatar_height = avatar_visible ? (avatar_bottom - avatar_y) : 0;
461 profile_indicator_icon()->SetBounds(pad, avatar_y, incognito_icon.width(), 462 profile_indicator_icon()->SetBounds(kAvatarIconPadding, avatar_y,
462 avatar_height); 463 incognito_icon.width(), avatar_height);
463 profile_indicator_icon()->SetVisible(avatar_visible); 464 profile_indicator_icon()->SetVisible(avatar_visible);
464 } 465 }
465 466
466 bool BrowserNonClientFrameViewAsh::ShouldPaint() const { 467 bool BrowserNonClientFrameViewAsh::ShouldPaint() const {
467 if (!frame()->IsFullscreen()) 468 if (!frame()->IsFullscreen())
468 return true; 469 return true;
469 470
470 // We need to paint when in immersive fullscreen and either: 471 // We need to paint when in immersive fullscreen and either:
471 // - The top-of-window views are revealed. 472 // - The top-of-window views are revealed.
472 // - The lightbar style tabstrip is visible. 473 // - The lightbar style tabstrip is visible.
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 toolbar_bounds.width(), 0); 509 toolbar_bounds.width(), 0);
509 BrowserView::Paint1pxHorizontalLine(canvas, GetToolbarTopSeparatorColor(), 510 BrowserView::Paint1pxHorizontalLine(canvas, GetToolbarTopSeparatorColor(),
510 separator_rect, true); 511 separator_rect, true);
511 512
512 // Toolbar/content separator. 513 // Toolbar/content separator.
513 toolbar_bounds.Inset(kClientEdgeThickness, 0); 514 toolbar_bounds.Inset(kClientEdgeThickness, 0);
514 BrowserView::Paint1pxHorizontalLine( 515 BrowserView::Paint1pxHorizontalLine(
515 canvas, tp->GetColor(ThemeProperties::COLOR_TOOLBAR_BOTTOM_SEPARATOR), 516 canvas, tp->GetColor(ThemeProperties::COLOR_TOOLBAR_BOTTOM_SEPARATOR),
516 toolbar_bounds, true); 517 toolbar_bounds, true);
517 } 518 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698