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/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/shell_window_ids.h" | 8 #include "ash/shell_window_ids.h" |
9 #include "ash/wm/window_util.h" | 9 #include "ash/wm/window_util.h" |
10 #include "base/logging.h" // DCHECK | 10 #include "base/logging.h" // DCHECK |
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
539 window_icon_->bounds().right() + kTitleIconOffsetX : | 539 window_icon_->bounds().right() + kTitleIconOffsetX : |
540 kTitleNoIconOffsetX; | 540 kTitleNoIconOffsetX; |
541 } | 541 } |
542 | 542 |
543 bool FramePainter::UseSoloWindowHeader(aura::Window* ignore) const { | 543 bool FramePainter::UseSoloWindowHeader(aura::Window* ignore) const { |
544 // In unit tests this can be called after the shell is destroyed. | 544 // In unit tests this can be called after the shell is destroyed. |
545 if (!Shell::HasInstance()) | 545 if (!Shell::HasInstance()) |
546 return false; | 546 return false; |
547 const aura::Window* default_container = Shell::GetInstance()->GetContainer( | 547 const aura::Window* default_container = Shell::GetInstance()->GetContainer( |
548 internal::kShellWindowId_DefaultContainer); | 548 internal::kShellWindowId_DefaultContainer); |
| 549 if (!default_container) |
| 550 return false; // Shutting down. See crbug.com/120786. |
549 int normal_window_count = 0; | 551 int normal_window_count = 0; |
550 const aura::Window::Windows& windows = default_container->children(); | 552 const aura::Window::Windows& windows = default_container->children(); |
551 for (aura::Window::Windows::const_iterator it = windows.begin(); | 553 for (aura::Window::Windows::const_iterator it = windows.begin(); |
552 it != windows.end(); | 554 it != windows.end(); |
553 ++it) { | 555 ++it) { |
554 if (*it != ignore && IsVisibleNormalWindow(*it)) { | 556 if (*it != ignore && IsVisibleNormalWindow(*it)) { |
555 normal_window_count++; | 557 normal_window_count++; |
556 if (normal_window_count > 1) | 558 if (normal_window_count > 1) |
557 return false; | 559 return false; |
558 } | 560 } |
559 } | 561 } |
560 return normal_window_count == 1; | 562 return normal_window_count == 1; |
561 } | 563 } |
562 | 564 |
563 } // namespace ash | 565 } // namespace ash |
OLD | NEW |