OLD | NEW |
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 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 const gfx::Rect rect_in_tabstrip_coords = | 399 const gfx::Rect rect_in_tabstrip_coords = |
400 gfx::ToEnclosingRect(rect_in_tabstrip_coords_f); | 400 gfx::ToEnclosingRect(rect_in_tabstrip_coords_f); |
401 return (rect_in_tabstrip_coords.y() <= tabstrip->height()) && | 401 return (rect_in_tabstrip_coords.y() <= tabstrip->height()) && |
402 (!tabstrip->HitTestRect(rect_in_tabstrip_coords) || | 402 (!tabstrip->HitTestRect(rect_in_tabstrip_coords) || |
403 tabstrip->IsRectInWindowCaption(rect_in_tabstrip_coords)); | 403 tabstrip->IsRectInWindowCaption(rect_in_tabstrip_coords)); |
404 } | 404 } |
405 | 405 |
406 int BrowserNonClientFrameViewMus::GetTabStripLeftInset() const { | 406 int BrowserNonClientFrameViewMus::GetTabStripLeftInset() const { |
407 const gfx::Insets insets(GetLayoutInsets(AVATAR_ICON)); | 407 const gfx::Insets insets(GetLayoutInsets(AVATAR_ICON)); |
408 const int avatar_right = profile_indicator_icon() | 408 const int avatar_right = profile_indicator_icon() |
409 ? (insets.left() + GetOTRAvatarIcon().width()) | 409 ? (insets.left() + GetIncognitoAvatarIcon().width()) |
410 : 0; | 410 : 0; |
411 return avatar_right + insets.right() + frame_values().normal_insets.left(); | 411 return avatar_right + insets.right() + frame_values().normal_insets.left(); |
412 } | 412 } |
413 | 413 |
414 int BrowserNonClientFrameViewMus::GetTabStripRightInset() const { | 414 int BrowserNonClientFrameViewMus::GetTabStripRightInset() const { |
415 const int frame_right_insets = frame_values().normal_insets.right() + | 415 const int frame_right_insets = frame_values().normal_insets.right() + |
416 frame_values().max_title_bar_button_width; | 416 frame_values().max_title_bar_button_width; |
417 int right_inset = kTabstripRightSpacing + frame_right_insets; | 417 int right_inset = kTabstripRightSpacing + frame_right_insets; |
418 | 418 |
419 #if defined(FRAME_AVATAR_BUTTON) | 419 #if defined(FRAME_AVATAR_BUTTON) |
420 if (profile_switcher_.view()) { | 420 if (profile_switcher_.view()) { |
(...skipping 28 matching lines...) Expand all Loading... |
449 return browser_view()->browser()->SupportsWindowFeature( | 449 return browser_view()->browser()->SupportsWindowFeature( |
450 Browser::FEATURE_WEBAPPFRAME); | 450 Browser::FEATURE_WEBAPPFRAME); |
451 } | 451 } |
452 | 452 |
453 void BrowserNonClientFrameViewMus::LayoutIncognitoButton() { | 453 void BrowserNonClientFrameViewMus::LayoutIncognitoButton() { |
454 DCHECK(profile_indicator_icon()); | 454 DCHECK(profile_indicator_icon()); |
455 #if !defined(OS_CHROMEOS) | 455 #if !defined(OS_CHROMEOS) |
456 // ChromeOS shows avatar on V1 app. | 456 // ChromeOS shows avatar on V1 app. |
457 DCHECK(browser_view()->IsTabStripVisible()); | 457 DCHECK(browser_view()->IsTabStripVisible()); |
458 #endif | 458 #endif |
459 gfx::ImageSkia incognito_icon = GetOTRAvatarIcon(); | 459 gfx::ImageSkia incognito_icon = GetIncognitoAvatarIcon(); |
460 gfx::Insets avatar_insets = GetLayoutInsets(AVATAR_ICON); | 460 gfx::Insets avatar_insets = GetLayoutInsets(AVATAR_ICON); |
461 int avatar_bottom = GetTopInset(false) + browser_view()->GetTabStripHeight() - | 461 int avatar_bottom = GetTopInset(false) + browser_view()->GetTabStripHeight() - |
462 avatar_insets.bottom(); | 462 avatar_insets.bottom(); |
463 int avatar_y = avatar_bottom - incognito_icon.height(); | 463 int avatar_y = avatar_bottom - incognito_icon.height(); |
464 if (!ui::MaterialDesignController::IsModeMaterial() && | 464 if (!ui::MaterialDesignController::IsModeMaterial() && |
465 browser_view()->IsTabStripVisible() && | 465 browser_view()->IsTabStripVisible() && |
466 (frame()->IsMaximized() || frame()->IsFullscreen())) { | 466 (frame()->IsMaximized() || frame()->IsFullscreen())) { |
467 avatar_y = GetTopInset(false) + kContentShadowHeight; | 467 avatar_y = GetTopInset(false) + kContentShadowHeight; |
468 } | 468 } |
469 | 469 |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
617 } | 617 } |
618 | 618 |
619 void BrowserNonClientFrameViewMus::PaintContentEdge(gfx::Canvas* canvas) { | 619 void BrowserNonClientFrameViewMus::PaintContentEdge(gfx::Canvas* canvas) { |
620 DCHECK(!UsePackagedAppHeaderStyle() && !UseWebAppHeaderStyle()); | 620 DCHECK(!UsePackagedAppHeaderStyle() && !UseWebAppHeaderStyle()); |
621 const int bottom = frame_values().normal_insets.bottom(); | 621 const int bottom = frame_values().normal_insets.bottom(); |
622 canvas->FillRect( | 622 canvas->FillRect( |
623 gfx::Rect(0, bottom, width(), kClientEdgeThickness), | 623 gfx::Rect(0, bottom, width(), kClientEdgeThickness), |
624 GetThemeProvider()->GetColor( | 624 GetThemeProvider()->GetColor( |
625 ThemeProperties::COLOR_TOOLBAR_BOTTOM_SEPARATOR)); | 625 ThemeProperties::COLOR_TOOLBAR_BOTTOM_SEPARATOR)); |
626 } | 626 } |
OLD | NEW |