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" |
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
585 return kSoloWindowOpacity; | 585 return kSoloWindowOpacity; |
586 | 586 |
587 // Otherwise, change transparency based on window activation status. | 587 // Otherwise, change transparency based on window activation status. |
588 if (header_mode == ACTIVE) | 588 if (header_mode == ACTIVE) |
589 return kActiveWindowOpacity; | 589 return kActiveWindowOpacity; |
590 return kInactiveWindowOpacity; | 590 return kInactiveWindowOpacity; |
591 } | 591 } |
592 | 592 |
593 // static | 593 // static |
594 bool FramePainter::UseSoloWindowHeader() { | 594 bool FramePainter::UseSoloWindowHeader() { |
| 595 if (!instances_) |
| 596 return false; // Return value shouldn't matter. |
| 597 |
595 int window_count = 0; | 598 int window_count = 0; |
596 for (std::set<FramePainter*>::const_iterator it = instances_->begin(); | 599 for (std::set<FramePainter*>::const_iterator it = instances_->begin(); |
597 it != instances_->end(); | 600 it != instances_->end(); |
598 ++it) { | 601 ++it) { |
599 // The window needs to be a 'normal window'. To exclude constrained windows | 602 // The window needs to be a 'normal window'. To exclude constrained windows |
600 // the existence of a layout manager gets additionally tested. | 603 // the existence of a layout manager gets additionally tested. |
601 if (IsVisibleNormalWindow((*it)->window_) && | 604 if (IsVisibleNormalWindow((*it)->window_) && |
602 (!(*it)->window_->GetProperty(ash::kConstrainedWindowKey))) { | 605 (!(*it)->window_->GetProperty(ash::kConstrainedWindowKey))) { |
603 window_count++; | 606 window_count++; |
604 if (window_count > 1) | 607 if (window_count > 1) |
605 return false; | 608 return false; |
606 } | 609 } |
607 } | 610 } |
608 return window_count == 1; | 611 return window_count == 1; |
609 } | 612 } |
610 | 613 |
611 // static | 614 // static |
612 void FramePainter::SchedulePaintForSoloWindow() { | 615 void FramePainter::SchedulePaintForSoloWindow() { |
| 616 if (!instances_) |
| 617 return; |
| 618 |
613 for (std::set<FramePainter*>::const_iterator it = instances_->begin(); | 619 for (std::set<FramePainter*>::const_iterator it = instances_->begin(); |
614 it != instances_->end(); | 620 it != instances_->end(); |
615 ++it) { | 621 ++it) { |
616 FramePainter* painter = *it; | 622 FramePainter* painter = *it; |
617 if (IsVisibleNormalWindow(painter->window_)) | 623 if (IsVisibleNormalWindow(painter->window_)) |
618 painter->frame_->non_client_view()->SchedulePaint(); | 624 painter->frame_->non_client_view()->SchedulePaint(); |
619 } | 625 } |
620 } | 626 } |
621 | 627 |
622 } // namespace ash | 628 } // namespace ash |
OLD | NEW |