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

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: rebase, fix unit test build 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
« no previous file with comments | « ui/aura_shell/laptop_mode_layout_manager.h ('k') | ui/aura_shell/root_window_layout_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 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 gfx::Rect bounds = requested_bounds;
49 // Avoid a janky resize on startup by ensuring the initial bounds fill the
50 // screen.
51 if (child->GetIntProperty(aura::kShowStateKey) == ui::SHOW_STATE_MAXIMIZED)
52 bounds = gfx::Screen::GetPrimaryMonitorBounds();
53 SetChildBoundsDirect(child, bounds);
54 }
55
56 void LaptopModeLayoutManager::OnWindowPropertyChanged(aura::Window* window,
57 const char* name,
58 void* old) {
59 if (name == aura::kShowStateKey)
60 UpdateBoundsFromShowState(window);
61 }
62
63 } // namespace internal
64 } // namespace aura_shell
OLDNEW
« no previous file with comments | « ui/aura_shell/laptop_mode_layout_manager.h ('k') | ui/aura_shell/root_window_layout_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698