summaryrefslogtreecommitdiffstats
path: root/ash/wm/frame_painter.cc
diff options
context:
space:
mode:
authoryoshiki@chromium.org <yoshiki@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-09 15:34:57 +0000
committeryoshiki@chromium.org <yoshiki@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-09 15:34:57 +0000
commit8506fb345e8ab16e2b798f7454776c608c424926 (patch)
tree061de56b3ff4ddfc781718485e68fea187cd7486 /ash/wm/frame_painter.cc
parentd6b58704ba4469ef4d514c9d514a5f4b8f4b6c63 (diff)
downloadchromium_src-8506fb345e8ab16e2b798f7454776c608c424926.zip
chromium_src-8506fb345e8ab16e2b798f7454776c608c424926.tar.gz
chromium_src-8506fb345e8ab16e2b798f7454776c608c424926.tar.bz2
ash: Be aware of always-on-top dialogs in UseSoloWindowHeader().
Originally, UseSoloWindowHeader() considers only windows in the default container. With this CL, it gets to consider not only the default container but also the always-on-top container. BUG=122611 TEST=manual Review URL: https://chromiumcodereview.appspot.com/10021022 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@131361 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/wm/frame_painter.cc')
-rw-r--r--ash/wm/frame_painter.cc44
1 files changed, 28 insertions, 16 deletions
diff --git a/ash/wm/frame_painter.cc b/ash/wm/frame_painter.cc
index 83f3790..527a089 100644
--- a/ash/wm/frame_painter.cc
+++ b/ash/wm/frame_painter.cc
@@ -120,6 +120,26 @@ bool IsVisibleNormalWindow(aura::Window* window) {
window->type() == aura::client::WINDOW_TYPE_NORMAL;
}
+// Returns a number of the windows in |container| except |ignore| window.
+int CountWindowInContainer(int container_id, aura::Window* ignore) {
+ const aura::Window* container =
+ ash::Shell::GetInstance()->GetContainer(container_id);
+ if (!container)
+ return 0; // Shutting down. See crbug.com/120786.
+ int normal_window_count = 0;
+ const aura::Window::Windows& windows = container->children();
+ for (aura::Window::Windows::const_iterator it = windows.begin();
+ it != windows.end();
+ ++it) {
+ if (*it != ignore && IsVisibleNormalWindow(*it)) {
+ normal_window_count++;
+ if (normal_window_count > 1)
+ return 2;
+ }
+ }
+ return normal_window_count;
+}
+
} // namespace
namespace ash {
@@ -571,22 +591,14 @@ bool FramePainter::UseSoloWindowHeader(aura::Window* ignore) const {
// In unit tests this can be called after the shell is destroyed.
if (!Shell::HasInstance())
return false;
- const aura::Window* default_container = Shell::GetInstance()->GetContainer(
- internal::kShellWindowId_DefaultContainer);
- if (!default_container)
- return false; // Shutting down. See crbug.com/120786.
- int normal_window_count = 0;
- const aura::Window::Windows& windows = default_container->children();
- for (aura::Window::Windows::const_iterator it = windows.begin();
- it != windows.end();
- ++it) {
- if (*it != ignore && IsVisibleNormalWindow(*it)) {
- normal_window_count++;
- if (normal_window_count > 1)
- return false;
- }
- }
- return normal_window_count == 1;
+ int window_count = 0;
+ window_count += CountWindowInContainer(
+ internal::kShellWindowId_DefaultContainer, ignore);
+ if (window_count > 1)
+ return false;
+ window_count += CountWindowInContainer(
+ internal::kShellWindowId_AlwaysOnTopContainer, ignore);
+ return window_count == 1;
}
} // namespace ash