| 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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 return window && | 118 return window && |
| 119 window->IsVisible() && | 119 window->IsVisible() && |
| 120 window->type() == aura::client::WINDOW_TYPE_NORMAL; | 120 window->type() == aura::client::WINDOW_TYPE_NORMAL; |
| 121 } | 121 } |
| 122 | 122 |
| 123 } // namespace | 123 } // namespace |
| 124 | 124 |
| 125 namespace ash { | 125 namespace ash { |
| 126 | 126 |
| 127 // static | 127 // static |
| 128 int FramePainter::kActiveWindowOpacity = 255; | 128 int FramePainter::kActiveWindowOpacity = 230; // "Linus-approved" values |
| 129 int FramePainter::kInactiveWindowOpacity = 166; | 129 int FramePainter::kInactiveWindowOpacity = 204; |
| 130 int FramePainter::kSoloWindowOpacity = 230; | 130 int FramePainter::kSoloWindowOpacity = 51; |
| 131 std::set<FramePainter*>* FramePainter::instances_ = NULL; | 131 std::set<FramePainter*>* FramePainter::instances_ = NULL; |
| 132 | 132 |
| 133 /////////////////////////////////////////////////////////////////////////////// | 133 /////////////////////////////////////////////////////////////////////////////// |
| 134 // FramePainter, public: | 134 // FramePainter, public: |
| 135 | 135 |
| 136 FramePainter::FramePainter() | 136 FramePainter::FramePainter() |
| 137 : frame_(NULL), | 137 : frame_(NULL), |
| 138 window_icon_(NULL), | 138 window_icon_(NULL), |
| 139 size_button_(NULL), | 139 size_button_(NULL), |
| 140 close_button_(NULL), | 140 close_button_(NULL), |
| (...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 561 theme_provider->GetBitmapNamed(pushed_bitmap_id)); | 561 theme_provider->GetBitmapNamed(pushed_bitmap_id)); |
| 562 } | 562 } |
| 563 | 563 |
| 564 int FramePainter::GetTitleOffsetX() const { | 564 int FramePainter::GetTitleOffsetX() const { |
| 565 return window_icon_ ? | 565 return window_icon_ ? |
| 566 window_icon_->bounds().right() + kTitleIconOffsetX : | 566 window_icon_->bounds().right() + kTitleIconOffsetX : |
| 567 kTitleNoIconOffsetX; | 567 kTitleNoIconOffsetX; |
| 568 } | 568 } |
| 569 | 569 |
| 570 bool FramePainter::UseSoloWindowHeader(aura::Window* ignore) const { | 570 bool FramePainter::UseSoloWindowHeader(aura::Window* ignore) const { |
| 571 // Maximized windows don't use solo window transparency. | |
| 572 if (frame_ && frame_->IsMaximized()) | |
| 573 return false; | |
| 574 // In unit tests this can be called after the shell is destroyed. | 571 // In unit tests this can be called after the shell is destroyed. |
| 575 if (!Shell::HasInstance()) | 572 if (!Shell::HasInstance()) |
| 576 return false; | 573 return false; |
| 577 const aura::Window* default_container = Shell::GetInstance()->GetContainer( | 574 const aura::Window* default_container = Shell::GetInstance()->GetContainer( |
| 578 internal::kShellWindowId_DefaultContainer); | 575 internal::kShellWindowId_DefaultContainer); |
| 579 if (!default_container) | 576 if (!default_container) |
| 580 return false; // Shutting down. See crbug.com/120786. | 577 return false; // Shutting down. See crbug.com/120786. |
| 581 int normal_window_count = 0; | 578 int normal_window_count = 0; |
| 582 const aura::Window::Windows& windows = default_container->children(); | 579 const aura::Window::Windows& windows = default_container->children(); |
| 583 for (aura::Window::Windows::const_iterator it = windows.begin(); | 580 for (aura::Window::Windows::const_iterator it = windows.begin(); |
| 584 it != windows.end(); | 581 it != windows.end(); |
| 585 ++it) { | 582 ++it) { |
| 586 if (*it != ignore && IsVisibleNormalWindow(*it)) { | 583 if (*it != ignore && IsVisibleNormalWindow(*it)) { |
| 587 normal_window_count++; | 584 normal_window_count++; |
| 588 if (normal_window_count > 1) | 585 if (normal_window_count > 1) |
| 589 return false; | 586 return false; |
| 590 } | 587 } |
| 591 } | 588 } |
| 592 return normal_window_count == 1; | 589 return normal_window_count == 1; |
| 593 } | 590 } |
| 594 | 591 |
| 595 } // namespace ash | 592 } // namespace ash |
| OLD | NEW |