| 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/window_util.h" | 10 #include "ash/wm/window_util.h" |
| 11 #include "ash/wm/workspace_controller.h" |
| 11 #include "base/logging.h" // DCHECK | 12 #include "base/logging.h" // DCHECK |
| 12 #include "grit/ui_resources.h" | 13 #include "grit/ui_resources.h" |
| 13 #include "third_party/skia/include/core/SkCanvas.h" | 14 #include "third_party/skia/include/core/SkCanvas.h" |
| 14 #include "third_party/skia/include/core/SkColor.h" | 15 #include "third_party/skia/include/core/SkColor.h" |
| 15 #include "third_party/skia/include/core/SkPaint.h" | 16 #include "third_party/skia/include/core/SkPaint.h" |
| 16 #include "third_party/skia/include/core/SkPath.h" | 17 #include "third_party/skia/include/core/SkPath.h" |
| 17 #include "ui/aura/client/aura_constants.h" | 18 #include "ui/aura/client/aura_constants.h" |
| 18 #include "ui/aura/env.h" | 19 #include "ui/aura/env.h" |
| 19 #include "ui/aura/window.h" | 20 #include "ui/aura/window.h" |
| 20 #include "ui/base/animation/slide_animation.h" | 21 #include "ui/base/animation/slide_animation.h" |
| (...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 586 if (header_mode == ACTIVE) | 587 if (header_mode == ACTIVE) |
| 587 return kActiveWindowOpacity; | 588 return kActiveWindowOpacity; |
| 588 return kInactiveWindowOpacity; | 589 return kInactiveWindowOpacity; |
| 589 } | 590 } |
| 590 | 591 |
| 591 // static | 592 // static |
| 592 bool FramePainter::UseSoloWindowHeader() { | 593 bool FramePainter::UseSoloWindowHeader() { |
| 593 if (!instances_) | 594 if (!instances_) |
| 594 return false; // Return value shouldn't matter. | 595 return false; // Return value shouldn't matter. |
| 595 | 596 |
| 596 int window_count = 0; | 597 aura::Window* window = NULL; |
| 597 for (std::set<FramePainter*>::const_iterator it = instances_->begin(); | 598 for (std::set<FramePainter*>::const_iterator it = instances_->begin(); |
| 598 it != instances_->end(); | 599 it != instances_->end(); |
| 599 ++it) { | 600 ++it) { |
| 600 // The window needs to be a 'normal window'. To exclude constrained windows | 601 // The window needs to be a 'normal window'. To exclude constrained windows |
| 601 // the existence of a layout manager gets additionally tested. | 602 // the existence of a layout manager gets additionally tested. |
| 602 if (IsVisibleNormalWindow((*it)->window_) && | 603 if (IsVisibleNormalWindow((*it)->window_) && |
| 603 (!(*it)->window_->GetProperty(ash::kConstrainedWindowKey))) { | 604 (!(*it)->window_->GetProperty(ash::kConstrainedWindowKey))) { |
| 604 window_count++; | 605 if (window) |
| 605 if (window_count > 1) | |
| 606 return false; | 606 return false; |
| 607 window = (*it)->window_; |
| 607 } | 608 } |
| 608 } | 609 } |
| 609 return window_count == 1; | 610 // We don't use the translucent background when a window is maximized with |
| 611 // workspace2 as otherwise the system background shows through the header. |
| 612 return window && (!internal::WorkspaceController::IsWorkspace2Enabled() || |
| 613 !wm::IsWindowMaximized(window)); |
| 610 } | 614 } |
| 611 | 615 |
| 612 // static | 616 // static |
| 613 void FramePainter::SchedulePaintForSoloWindow() { | 617 void FramePainter::SchedulePaintForSoloWindow() { |
| 614 if (!instances_) | 618 if (!instances_) |
| 615 return; | 619 return; |
| 616 | 620 |
| 617 for (std::set<FramePainter*>::const_iterator it = instances_->begin(); | 621 for (std::set<FramePainter*>::const_iterator it = instances_->begin(); |
| 618 it != instances_->end(); | 622 it != instances_->end(); |
| 619 ++it) { | 623 ++it) { |
| 620 FramePainter* painter = *it; | 624 FramePainter* painter = *it; |
| 621 if (IsVisibleNormalWindow(painter->window_)) | 625 if (IsVisibleNormalWindow(painter->window_)) |
| 622 painter->frame_->non_client_view()->SchedulePaint(); | 626 painter->frame_->non_client_view()->SchedulePaint(); |
| 623 } | 627 } |
| 624 } | 628 } |
| 625 | 629 |
| 626 } // namespace ash | 630 } // namespace ash |
| OLD | NEW |