| OLD | NEW |
| 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 "ash/wm/frame_painter.h" | 5 #include "ash/wm/frame_painter.h" |
| 6 | 6 |
| 7 #include "ash/ash_constants.h" | 7 #include "ash/ash_constants.h" |
| 8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
| 9 #include "ash/shell_window_ids.h" | 9 #include "ash/shell_window_ids.h" |
| 10 #include "ash/wm/property_util.h" | 10 #include "ash/wm/property_util.h" |
| (...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 464 title_bounds.y(), | 464 title_bounds.y(), |
| 465 title_bounds.width(), | 465 title_bounds.width(), |
| 466 title_bounds.height(), | 466 title_bounds.height(), |
| 467 gfx::Canvas::NO_SUBPIXEL_RENDERING); | 467 gfx::Canvas::NO_SUBPIXEL_RENDERING); |
| 468 } | 468 } |
| 469 } | 469 } |
| 470 | 470 |
| 471 void FramePainter::LayoutHeader(views::NonClientFrameView* view, | 471 void FramePainter::LayoutHeader(views::NonClientFrameView* view, |
| 472 bool shorter_layout) { | 472 bool shorter_layout) { |
| 473 // The new assets only make sense if the window is actually maximized. | 473 // The new assets only make sense if the window is actually maximized. |
| 474 if (internal::WorkspaceController::IsWorkspace2Enabled() && | 474 if (shorter_layout && frame_->IsMaximized() && |
| 475 shorter_layout && frame_->IsMaximized() && | |
| 476 GetTrackedByWorkspace(frame_->GetNativeWindow())) { | 475 GetTrackedByWorkspace(frame_->GetNativeWindow())) { |
| 477 SetButtonImages(close_button_, | 476 SetButtonImages(close_button_, |
| 478 IDR_AURA_WINDOW_MAXIMIZED_CLOSE2, | 477 IDR_AURA_WINDOW_MAXIMIZED_CLOSE2, |
| 479 IDR_AURA_WINDOW_MAXIMIZED_CLOSE2_H, | 478 IDR_AURA_WINDOW_MAXIMIZED_CLOSE2_H, |
| 480 IDR_AURA_WINDOW_MAXIMIZED_CLOSE2_P); | 479 IDR_AURA_WINDOW_MAXIMIZED_CLOSE2_P); |
| 481 // The chat window cannot be restored but only minimized. | 480 // The chat window cannot be restored but only minimized. |
| 482 // Case: (size_button_behavior_ == SIZE_BUTTON_MINIMIZES). We used to have | 481 // Case: (size_button_behavior_ == SIZE_BUTTON_MINIMIZES). We used to have |
| 483 // a special set of artwork to show this case, but per discussion we | 482 // a special set of artwork to show this case, but per discussion we |
| 484 // removed this. | 483 // removed this. |
| 485 SetButtonImages(size_button_, | 484 SetButtonImages(size_button_, |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 645 int theme_frame_id, | 644 int theme_frame_id, |
| 646 const gfx::ImageSkia* theme_frame_overlay) { | 645 const gfx::ImageSkia* theme_frame_overlay) { |
| 647 // User-provided themes are painted fully opaque. | 646 // User-provided themes are painted fully opaque. |
| 648 if (frame_->GetThemeProvider()->HasCustomImage(theme_frame_id)) | 647 if (frame_->GetThemeProvider()->HasCustomImage(theme_frame_id)) |
| 649 return kFullyOpaque; | 648 return kFullyOpaque; |
| 650 if (theme_frame_overlay) | 649 if (theme_frame_overlay) |
| 651 return kFullyOpaque; | 650 return kFullyOpaque; |
| 652 | 651 |
| 653 // Maximized windows with workspace2 are totally transparent, except those not | 652 // Maximized windows with workspace2 are totally transparent, except those not |
| 654 // tracked by workspace code (which are used for tab dragging). | 653 // tracked by workspace code (which are used for tab dragging). |
| 655 if (frame_->IsMaximized() && | 654 if (frame_->IsMaximized() && GetTrackedByWorkspace(frame_->GetNativeWindow())) |
| 656 internal::WorkspaceController::IsWorkspace2Enabled() && | |
| 657 GetTrackedByWorkspace(frame_->GetNativeWindow())) | |
| 658 return 0; | 655 return 0; |
| 659 | 656 |
| 660 // Single browser window is very transparent. | 657 // Single browser window is very transparent. |
| 661 if (UseSoloWindowHeader()) | 658 if (UseSoloWindowHeader()) |
| 662 return kSoloWindowOpacity; | 659 return kSoloWindowOpacity; |
| 663 | 660 |
| 664 // Otherwise, change transparency based on window activation status. | 661 // Otherwise, change transparency based on window activation status. |
| 665 if (header_mode == ACTIVE) | 662 if (header_mode == ACTIVE) |
| 666 return kActiveWindowOpacity; | 663 return kActiveWindowOpacity; |
| 667 return kInactiveWindowOpacity; | 664 return kInactiveWindowOpacity; |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 724 if (ignorable_window == (*it)->window_) | 721 if (ignorable_window == (*it)->window_) |
| 725 continue; | 722 continue; |
| 726 | 723 |
| 727 if (root_window != (*it)->window_->GetRootWindow()) | 724 if (root_window != (*it)->window_->GetRootWindow()) |
| 728 continue; | 725 continue; |
| 729 | 726 |
| 730 // The window needs to be a 'normal window'. To exclude constrained windows | 727 // The window needs to be a 'normal window'. To exclude constrained windows |
| 731 // the existence of a layout manager gets additionally tested. | 728 // the existence of a layout manager gets additionally tested. |
| 732 if (IsVisibleNormalWindow((*it)->window_) && | 729 if (IsVisibleNormalWindow((*it)->window_) && |
| 733 (!(*it)->window_->GetProperty(ash::kConstrainedWindowKey))) { | 730 (!(*it)->window_->GetProperty(ash::kConstrainedWindowKey))) { |
| 734 if (internal::WorkspaceController::IsWorkspace2Enabled() && | 731 if (wm::IsWindowMaximized((*it)->window_)) { |
| 735 wm::IsWindowMaximized((*it)->window_)) { | |
| 736 return NULL; | 732 return NULL; |
| 737 } | 733 } |
| 738 if (painter) | 734 if (painter) |
| 739 return NULL; | 735 return NULL; |
| 740 | 736 |
| 741 painter = (*it); | 737 painter = (*it); |
| 742 } | 738 } |
| 743 } | 739 } |
| 744 | 740 |
| 745 return painter; | 741 return painter; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 780 int title_y = | 776 int title_y = |
| 781 (view->GetBoundsForClientView().y() - title_font.GetHeight()) / 2; | 777 (view->GetBoundsForClientView().y() - title_font.GetHeight()) / 2; |
| 782 return gfx::Rect( | 778 return gfx::Rect( |
| 783 title_x, | 779 title_x, |
| 784 std::max(0, title_y), | 780 std::max(0, title_y), |
| 785 std::max(0, size_button_->x() - kTitleLogoSpacing - title_x), | 781 std::max(0, size_button_->x() - kTitleLogoSpacing - title_x), |
| 786 title_font.GetHeight()); | 782 title_font.GetHeight()); |
| 787 } | 783 } |
| 788 | 784 |
| 789 } // namespace ash | 785 } // namespace ash |
| OLD | NEW |