summaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorjamescook@chromium.org <jamescook@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-23 08:04:39 +0000
committerjamescook@chromium.org <jamescook@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-23 08:04:39 +0000
commit44d4201b7239af3dfb0d8a50d2cc85989c3e4103 (patch)
treee392a678fda16221ea6c67a352caced924171579 /ui
parent1c3bd20ed76da6bb5418446c6f18f2eaf3678ad9 (diff)
downloadchromium_src-44d4201b7239af3dfb0d8a50d2cc85989c3e4103.zip
chromium_src-44d4201b7239af3dfb0d8a50d2cc85989c3e4103.tar.gz
chromium_src-44d4201b7239af3dfb0d8a50d2cc85989c3e4103.tar.bz2
Aura: Hide status area when going fullscreen in compact window mode
Just hide the entire widget if there's a fullscreen window open. BUG=108184 TEST=manual Review URL: http://codereview.chromium.org/9025032 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@115694 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r--ui/aura_shell/compact_layout_manager.cc28
-rw-r--r--ui/aura_shell/compact_layout_manager.h12
-rw-r--r--ui/aura_shell/shell.cc2
-rw-r--r--ui/aura_shell/toplevel_layout_manager.cc11
-rw-r--r--ui/aura_shell/window_util.cc10
-rw-r--r--ui/aura_shell/window_util.h6
6 files changed, 54 insertions, 15 deletions
diff --git a/ui/aura_shell/compact_layout_manager.cc b/ui/aura_shell/compact_layout_manager.cc
index e7b762e..059a478 100644
--- a/ui/aura_shell/compact_layout_manager.cc
+++ b/ui/aura_shell/compact_layout_manager.cc
@@ -9,11 +9,13 @@
#include "ui/aura_shell/window_util.h"
#include "ui/base/ui_base_types.h"
#include "ui/gfx/screen.h"
+#include "ui/views/widget/widget.h"
namespace aura_shell {
namespace internal {
-CompactLayoutManager::CompactLayoutManager() {
+CompactLayoutManager::CompactLayoutManager(views::Widget* status_area_widget)
+ : status_area_widget_(status_area_widget) {
}
CompactLayoutManager::~CompactLayoutManager() {
@@ -27,8 +29,10 @@ void CompactLayoutManager::OnWindowResized() {
void CompactLayoutManager::OnWindowAddedToLayout(aura::Window* child) {
windows_.insert(child);
child->AddObserver(this);
- if (child->GetProperty(aura::client::kShowStateKey))
+ if (child->GetProperty(aura::client::kShowStateKey)) {
UpdateBoundsFromShowState(child);
+ UpdateStatusAreaVisibility();
+ }
}
void CompactLayoutManager::OnWillRemoveWindowFromLayout(aura::Window* child) {
@@ -39,6 +43,7 @@ void CompactLayoutManager::OnWillRemoveWindowFromLayout(aura::Window* child) {
void CompactLayoutManager::OnChildWindowVisibilityChanged(
aura::Window* child,
bool visibile) {
+ UpdateStatusAreaVisibility();
}
void CompactLayoutManager::SetChildBounds(
@@ -55,8 +60,25 @@ void CompactLayoutManager::SetChildBounds(
void CompactLayoutManager::OnWindowPropertyChanged(aura::Window* window,
const char* name,
void* old) {
- if (name == aura::client::kShowStateKey)
+ if (name == aura::client::kShowStateKey) {
UpdateBoundsFromShowState(window);
+ UpdateStatusAreaVisibility();
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// CompactLayoutManager, private:
+
+void CompactLayoutManager::UpdateStatusAreaVisibility() {
+ if (!status_area_widget_)
+ return;
+ // Full screen windows should hide the status area widget.
+ bool fullscreen_window = HasFullscreenWindow(windows_);
+ bool widget_visible = status_area_widget_->IsVisible();
+ if (fullscreen_window && widget_visible)
+ status_area_widget_->Hide();
+ else if (!fullscreen_window && !widget_visible)
+ status_area_widget_->Show();
}
} // namespace internal
diff --git a/ui/aura_shell/compact_layout_manager.h b/ui/aura_shell/compact_layout_manager.h
index b7d1acb..5d4dd85 100644
--- a/ui/aura_shell/compact_layout_manager.h
+++ b/ui/aura_shell/compact_layout_manager.h
@@ -14,6 +14,10 @@
#include "ui/aura/window_observer.h"
#include "ui/aura_shell/aura_shell_export.h"
+namespace views {
+class Widget;
+}
+
namespace aura_shell {
namespace internal {
@@ -24,7 +28,7 @@ namespace internal {
class AURA_SHELL_EXPORT CompactLayoutManager : public aura::LayoutManager,
public aura::WindowObserver {
public:
- CompactLayoutManager();
+ explicit CompactLayoutManager(views::Widget* status_area_widget);
virtual ~CompactLayoutManager();
// LayoutManager overrides:
@@ -44,9 +48,15 @@ class AURA_SHELL_EXPORT CompactLayoutManager : public aura::LayoutManager,
private:
typedef std::set<aura::Window*> Windows;
+ // Hides the status area when full screen windows cover it.
+ void UpdateStatusAreaVisibility();
+
// Set of windows we're listening to.
Windows windows_;
+ // Weak pointer to status area with clock, network, battery, etc. icons.
+ views::Widget* status_area_widget_;
+
DISALLOW_COPY_AND_ASSIGN(CompactLayoutManager);
};
diff --git a/ui/aura_shell/shell.cc b/ui/aura_shell/shell.cc
index f73c39e..6fb354d 100644
--- a/ui/aura_shell/shell.cc
+++ b/ui/aura_shell/shell.cc
@@ -268,7 +268,7 @@ void Shell::InitLayoutManagers(aura::RootWindow* root_window) {
// desktop background, shelf, etc.
if (switches::IsAuraWindowModeCompact()) {
default_container->SetLayoutManager(
- new internal::CompactLayoutManager());
+ new internal::CompactLayoutManager(status_widget));
internal::CompactStatusAreaLayoutManager* status_area_layout_manager =
new internal::CompactStatusAreaLayoutManager(status_widget);
GetContainer(internal::kShellWindowId_StatusContainer)->
diff --git a/ui/aura_shell/toplevel_layout_manager.cc b/ui/aura_shell/toplevel_layout_manager.cc
index 81f0704..872da95 100644
--- a/ui/aura_shell/toplevel_layout_manager.cc
+++ b/ui/aura_shell/toplevel_layout_manager.cc
@@ -70,16 +70,7 @@ void ToplevelLayoutManager::OnWindowPropertyChanged(aura::Window* window,
void ToplevelLayoutManager::UpdateShelfVisibility() {
if (!shelf_)
return;
-
- bool has_fullscreen_window = false;
- for (Windows::const_iterator i = windows_.begin(); i != windows_.end(); ++i) {
- if ((*i)->GetIntProperty(aura::client::kShowStateKey) ==
- ui::SHOW_STATE_FULLSCREEN) {
- has_fullscreen_window = true;
- break;
- }
- }
- shelf_->SetVisible(!has_fullscreen_window);
+ shelf_->SetVisible(!HasFullscreenWindow(windows_));
}
} // namespace internal
diff --git a/ui/aura_shell/window_util.cc b/ui/aura_shell/window_util.cc
index a6e5e0d..6dd9cde 100644
--- a/ui/aura_shell/window_util.cc
+++ b/ui/aura_shell/window_util.cc
@@ -66,4 +66,14 @@ void UpdateBoundsFromShowState(aura::Window* window) {
}
}
+bool HasFullscreenWindow(const WindowSet& windows) {
+ for (WindowSet::const_iterator i = windows.begin(); i != windows.end(); ++i) {
+ if ((*i)->GetIntProperty(aura::client::kShowStateKey)
+ == ui::SHOW_STATE_FULLSCREEN) {
+ return true;
+ }
+ }
+ return false;
+}
+
} // namespace aura_shell
diff --git a/ui/aura_shell/window_util.h b/ui/aura_shell/window_util.h
index 2327b83..afe8465 100644
--- a/ui/aura_shell/window_util.h
+++ b/ui/aura_shell/window_util.h
@@ -6,6 +6,8 @@
#define UI_AURA_SHELL_WINDOW_UTIL_H_
#pragma once
+#include <set>
+
#include "ui/aura_shell/aura_shell_export.h"
namespace aura {
@@ -35,6 +37,10 @@ AURA_SHELL_EXPORT aura::Window* GetActivatableWindow(aura::Window* window);
// Update window bounds based on a change in show state.
AURA_SHELL_EXPORT void UpdateBoundsFromShowState(aura::Window* window);
+// Returns true if the set of |windows| contains a full-screen window.
+typedef std::set<aura::Window*> WindowSet;
+AURA_SHELL_EXPORT bool HasFullscreenWindow(const WindowSet& windows);
+
} // namespace aura_shell
#endif // UI_AURA_SHELL_WINDOW_UTIL_H_