OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/views/frame/opaque_non_client_view.h" | 5 #include "chrome/browser/views/frame/opaque_non_client_view.h" |
6 | 6 |
7 #include "grit/theme_resources.h" | 7 #include "grit/theme_resources.h" |
8 #include "chrome/browser/views/frame/browser_view.h" | 8 #include "chrome/browser/views/frame/browser_view.h" |
9 #include "chrome/browser/views/tabs/tab_strip.h" | 9 #include "chrome/browser/views/tabs/tab_strip.h" |
10 #include "chrome/common/gfx/chrome_font.h" | 10 #include "chrome/common/gfx/chrome_font.h" |
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
515 NonClientBorderThickness(), kResizeAreaCornerSize, kResizeAreaCornerSize, | 515 NonClientBorderThickness(), kResizeAreaCornerSize, kResizeAreaCornerSize, |
516 frame_->window_delegate()->CanResize()); | 516 frame_->window_delegate()->CanResize()); |
517 // Fall back to the caption if no other component matches. | 517 // Fall back to the caption if no other component matches. |
518 return (window_component == HTNOWHERE) ? HTCAPTION : window_component; | 518 return (window_component == HTNOWHERE) ? HTCAPTION : window_component; |
519 } | 519 } |
520 | 520 |
521 void OpaqueNonClientView::GetWindowMask(const gfx::Size& size, | 521 void OpaqueNonClientView::GetWindowMask(const gfx::Size& size, |
522 gfx::Path* window_mask) { | 522 gfx::Path* window_mask) { |
523 DCHECK(window_mask); | 523 DCHECK(window_mask); |
524 | 524 |
| 525 if (browser_view_->IsFullscreen()) |
| 526 return; |
| 527 |
525 // Redefine the window visible region for the new size. | 528 // Redefine the window visible region for the new size. |
526 window_mask->moveTo(0, 3); | 529 window_mask->moveTo(0, 3); |
527 window_mask->lineTo(1, 2); | 530 window_mask->lineTo(1, 2); |
528 window_mask->lineTo(1, 1); | 531 window_mask->lineTo(1, 1); |
529 window_mask->lineTo(2, 1); | 532 window_mask->lineTo(2, 1); |
530 window_mask->lineTo(3, 0); | 533 window_mask->lineTo(3, 0); |
531 | 534 |
532 window_mask->lineTo(SkIntToScalar(size.width() - 3), 0); | 535 window_mask->lineTo(SkIntToScalar(size.width() - 3), 0); |
533 window_mask->lineTo(SkIntToScalar(size.width() - 2), 1); | 536 window_mask->lineTo(SkIntToScalar(size.width() - 2), 1); |
534 window_mask->lineTo(SkIntToScalar(size.width() - 1), 1); | 537 window_mask->lineTo(SkIntToScalar(size.width() - 1), 1); |
(...skipping 14 matching lines...) Expand all Loading... |
549 restore_button_->SetState(views::Button::BS_NORMAL); | 552 restore_button_->SetState(views::Button::BS_NORMAL); |
550 minimize_button_->SetState(views::Button::BS_NORMAL); | 553 minimize_button_->SetState(views::Button::BS_NORMAL); |
551 maximize_button_->SetState(views::Button::BS_NORMAL); | 554 maximize_button_->SetState(views::Button::BS_NORMAL); |
552 // The close button isn't affected by this constraint. | 555 // The close button isn't affected by this constraint. |
553 } | 556 } |
554 | 557 |
555 /////////////////////////////////////////////////////////////////////////////// | 558 /////////////////////////////////////////////////////////////////////////////// |
556 // OpaqueNonClientView, views::View overrides: | 559 // OpaqueNonClientView, views::View overrides: |
557 | 560 |
558 void OpaqueNonClientView::Paint(ChromeCanvas* canvas) { | 561 void OpaqueNonClientView::Paint(ChromeCanvas* canvas) { |
| 562 if (browser_view_->IsFullscreen()) |
| 563 return; // Nothing is visible, so don't bother to paint. |
| 564 |
559 if (frame_->IsMaximized()) | 565 if (frame_->IsMaximized()) |
560 PaintMaximizedFrameBorder(canvas); | 566 PaintMaximizedFrameBorder(canvas); |
561 else | 567 else |
562 PaintRestoredFrameBorder(canvas); | 568 PaintRestoredFrameBorder(canvas); |
563 PaintDistributorLogo(canvas); | 569 PaintDistributorLogo(canvas); |
564 PaintTitleBar(canvas); | 570 PaintTitleBar(canvas); |
565 PaintToolbarBackground(canvas); | 571 PaintToolbarBackground(canvas); |
566 PaintOTRAvatar(canvas); | 572 PaintOTRAvatar(canvas); |
567 if (!frame_->IsMaximized()) | 573 if (!frame_->IsMaximized()) |
568 PaintRestoredClientEdge(canvas); | 574 PaintRestoredClientEdge(canvas); |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
655 } | 661 } |
656 | 662 |
657 SkBitmap OpaqueNonClientView::GetFavIconForTabIconView() { | 663 SkBitmap OpaqueNonClientView::GetFavIconForTabIconView() { |
658 return frame_->window_delegate()->GetWindowIcon(); | 664 return frame_->window_delegate()->GetWindowIcon(); |
659 } | 665 } |
660 | 666 |
661 /////////////////////////////////////////////////////////////////////////////// | 667 /////////////////////////////////////////////////////////////////////////////// |
662 // OpaqueNonClientView, private: | 668 // OpaqueNonClientView, private: |
663 | 669 |
664 int OpaqueNonClientView::FrameBorderThickness() const { | 670 int OpaqueNonClientView::FrameBorderThickness() const { |
| 671 if (browser_view_->IsFullscreen()) |
| 672 return 0; |
665 return frame_->IsMaximized() ? | 673 return frame_->IsMaximized() ? |
666 GetSystemMetrics(SM_CXSIZEFRAME) : kFrameBorderThickness; | 674 GetSystemMetrics(SM_CXSIZEFRAME) : kFrameBorderThickness; |
667 } | 675 } |
668 | 676 |
669 int OpaqueNonClientView::TopResizeHeight() const { | 677 int OpaqueNonClientView::TopResizeHeight() const { |
670 return FrameBorderThickness() - kTopResizeAdjust; | 678 return FrameBorderThickness() - kTopResizeAdjust; |
671 } | 679 } |
672 | 680 |
673 int OpaqueNonClientView::NonClientBorderThickness() const { | 681 int OpaqueNonClientView::NonClientBorderThickness() const { |
674 // In maximized mode, we don't show a client edge. | 682 // In maximized mode, we don't show a client edge. |
675 return FrameBorderThickness() + | 683 return FrameBorderThickness() + |
676 (frame_->IsMaximized() ? 0 : kClientEdgeThickness); | 684 ((frame_->IsMaximized() || browser_view_->IsFullscreen()) ? |
| 685 0 : kClientEdgeThickness); |
677 } | 686 } |
678 | 687 |
679 int OpaqueNonClientView::NonClientTopBorderHeight() const { | 688 int OpaqueNonClientView::NonClientTopBorderHeight() const { |
680 if (frame_->window_delegate()->ShouldShowWindowTitle()) { | 689 if (frame_->window_delegate()->ShouldShowWindowTitle()) { |
681 int title_top_spacing, title_thickness; | 690 int title_top_spacing, title_thickness; |
682 return TitleCoordinates(&title_top_spacing, &title_thickness); | 691 return TitleCoordinates(&title_top_spacing, &title_thickness); |
683 } | 692 } |
684 | 693 |
685 return FrameBorderThickness() + | 694 return FrameBorderThickness() + |
686 (frame_->IsMaximized() ? 0 : kNonClientRestoredExtraThickness); | 695 ((frame_->IsMaximized() || browser_view_->IsFullscreen()) ? |
| 696 0 : kNonClientRestoredExtraThickness); |
687 } | 697 } |
688 | 698 |
689 int OpaqueNonClientView::BottomEdgeThicknessWithinNonClientHeight() const { | 699 int OpaqueNonClientView::BottomEdgeThicknessWithinNonClientHeight() const { |
690 if (browser_view_->IsToolbarVisible()) | 700 if (browser_view_->IsToolbarVisible()) |
691 return 0; | 701 return 0; |
692 return kFrameShadowThickness + | 702 return kFrameShadowThickness + |
693 (frame_->IsMaximized() ? 0 : kClientEdgeThickness); | 703 (frame_->IsMaximized() ? 0 : kClientEdgeThickness); |
694 } | 704 } |
695 | 705 |
696 int OpaqueNonClientView::TitleCoordinates(int* title_top_spacing, | 706 int OpaqueNonClientView::TitleCoordinates(int* title_top_spacing, |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1056 } | 1066 } |
1057 | 1067 |
1058 // static | 1068 // static |
1059 void OpaqueNonClientView::InitAppWindowResources() { | 1069 void OpaqueNonClientView::InitAppWindowResources() { |
1060 static bool initialized = false; | 1070 static bool initialized = false; |
1061 if (!initialized) { | 1071 if (!initialized) { |
1062 title_font_ = win_util::GetWindowTitleFont(); | 1072 title_font_ = win_util::GetWindowTitleFont(); |
1063 initialized = true; | 1073 initialized = true; |
1064 } | 1074 } |
1065 } | 1075 } |
OLD | NEW |