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

Side by Side Diff: ui/aura_shell/laptop_mode_layout_manager.cc

Issue 8895003: Aura: Add --aura-laptop-mode to fill the workspace with a single window. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: maximize ALL the windows Created 9 years 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "ui/aura_shell/laptop_mode_layout_manager.h"
6
7 #include "ui/aura/client/aura_constants.h"
8 #include "ui/aura/window.h"
9 #include "ui/aura_shell/window_util.h"
10 #include "ui/base/ui_base_types.h"
11 #include "ui/gfx/screen.h"
12
13 namespace aura_shell {
14 namespace internal {
15
16 LaptopModeLayoutManager::LaptopModeLayoutManager() {
17 }
18
19 LaptopModeLayoutManager::~LaptopModeLayoutManager() {
20 for (Windows::const_iterator i = windows_.begin(); i != windows_.end(); ++i)
21 (*i)->RemoveObserver(this);
22 }
23
24 void LaptopModeLayoutManager::OnWindowResized() {
25 }
26
27 void LaptopModeLayoutManager::OnWindowAddedToLayout(aura::Window* child) {
28 windows_.insert(child);
29 child->AddObserver(this);
30 if (child->GetProperty(aura::kShowStateKey))
31 window_util::UpdateBoundsFromShowState(child);
32 }
33
34 void LaptopModeLayoutManager::OnWillRemoveWindowFromLayout(
35 aura::Window* child) {
36 windows_.erase(child);
37 child->RemoveObserver(this);
38 }
39
40 void LaptopModeLayoutManager::OnChildWindowVisibilityChanged(
41 aura::Window* child,
42 bool visibile) {
43 }
44
45 void LaptopModeLayoutManager::SetChildBounds(
46 aura::Window* child,
47 const gfx::Rect& requested_bounds) {
48 // In laptop mode normal windows always fill the work area.
49 // TODO(jamescook): Make this apply only to tabbed browser windows -- right
50 // now browser popups fill the screen too.
51 if (child->type() == aura::WINDOW_TYPE_NORMAL) {
52 gfx::Rect work_area_bounds =
53 gfx::Screen::GetMonitorWorkAreaNearestWindow(child);
54 if (requested_bounds != work_area_bounds) {
55 child->SetBounds(work_area_bounds);
56 return;
57 }
58 }
59 SetChildBoundsDirect(child, requested_bounds);
60 }
61
62 void LaptopModeLayoutManager::OnWindowPropertyChanged(aura::Window* window,
63 const char* name,
64 void* old) {
65 if (name == aura::kShowStateKey)
66 window_util::UpdateBoundsFromShowState(window);
67 }
68
69 } // namespace internal
70 } // namespace aura_shell
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698