Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(352)

Unified Diff: athena/util/fill_layout_manager.cc

Issue 697143005: Fills athena background always. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: visibility changed Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « athena/util/fill_layout_manager.h ('k') | athena/util/fill_layout_manager_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: athena/util/fill_layout_manager.cc
diff --git a/athena/util/fill_layout_manager.cc b/athena/util/fill_layout_manager.cc
index 8e239a22f50941a61d53bf9cb1b96a1ad8babc89..2a3eb22f374d6808b02dcb3a306ac58301d14d9f 100644
--- a/athena/util/fill_layout_manager.cc
+++ b/athena/util/fill_layout_manager.cc
@@ -6,19 +6,31 @@
#include "base/logging.h"
#include "ui/aura/window.h"
+#include "ui/aura/window_property.h"
+
+// This is to avoid creating type definitoin for kAlwaysFillWindowKey.
+DECLARE_EXPORTED_WINDOW_PROPERTY_TYPE(ATHENA_EXPORT, bool);
namespace athena {
namespace {
+DEFINE_LOCAL_WINDOW_PROPERTY_KEY(bool, kAlwaysFillWindowKey, false);
+
// TODO(oshima): Implement real window/layout manager. crbug.com/388362.
bool ShouldFill(aura::Window* window) {
- return window->type() != ui::wm::WINDOW_TYPE_MENU &&
- window->type() != ui::wm::WINDOW_TYPE_TOOLTIP &&
- window->type() != ui::wm::WINDOW_TYPE_POPUP;
+ return window->GetProperty(kAlwaysFillWindowKey) ||
+ (window->type() != ui::wm::WINDOW_TYPE_MENU &&
+ window->type() != ui::wm::WINDOW_TYPE_TOOLTIP &&
+ window->type() != ui::wm::WINDOW_TYPE_POPUP);
}
} // namespace
+// static
+void FillLayoutManager::SetAlwaysFill(aura::Window* window) {
+ window->SetProperty(kAlwaysFillWindowKey, true);
+}
+
FillLayoutManager::FillLayoutManager(aura::Window* container)
: container_(container) {
DCHECK(container_);
@@ -40,16 +52,21 @@ void FillLayoutManager::OnWindowResized() {
void FillLayoutManager::OnWindowAddedToLayout(aura::Window* child) {
if (ShouldFill(child))
- SetChildBoundsDirect(child, (gfx::Rect(container_->bounds().size())));
+ SetChildBoundsDirect(child, gfx::Rect(container_->bounds().size()));
}
void FillLayoutManager::OnWillRemoveWindowFromLayout(aura::Window* child) {
}
+
void FillLayoutManager::OnWindowRemovedFromLayout(aura::Window* child) {
}
+
void FillLayoutManager::OnChildWindowVisibilityChanged(aura::Window* child,
bool visible) {
+ if (visible && ShouldFill(child))
+ SetChildBoundsDirect(child, gfx::Rect(container_->bounds().size()));
}
+
void FillLayoutManager::SetChildBounds(aura::Window* child,
const gfx::Rect& requested_bounds) {
if (!ShouldFill(child))
« no previous file with comments | « athena/util/fill_layout_manager.h ('k') | athena/util/fill_layout_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698