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

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

Issue 8400063: Move maximize/fullscreen/restore to shell (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: addressed comments, property_util Created 9 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 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/show_state_controller.h"
6
7 #include "ui/aura/aura_constants.h"
8 #include "ui/aura/window.h"
9 #include "ui/aura_shell/default_container_layout_manager.h"
10 #include "ui/aura_shell/property_util.h"
11 #include "ui/aura_shell/workspace/workspace.h"
12 #include "ui/aura_shell/workspace/workspace_manager.h"
13 #include "ui/base/ui_base_types.h"
14
15 namespace aura_shell {
16 namespace internal {
17
18 ShowStateController::ShowStateController(
19 DefaultContainerLayoutManager* layout_manager)
20 : layout_manager_(layout_manager) {
21 }
22
23 ShowStateController::~ShowStateController() {
24 }
25
26 void ShowStateController::OnPropertyChanged(aura::Window* window,
27 const char* name,
28 void* old) OVERRIDE {
29 if (name != aura::kShowStateKey)
30 return;
31 if (window->GetIntProperty(name) == ui::SHOW_STATE_NORMAL) {
32 // Restore the size of window first, then let Workspace layout the window.
33 const gfx::Rect* restore = GetRestoreBounds(window);
34 window->SetProperty(aura::kRestoreBoundsKey, NULL);
35 if (restore)
36 window->SetBounds(*restore);
37 delete restore;
38 } else if (old == reinterpret_cast<void*>(ui::SHOW_STATE_NORMAL)) {
39 // Store the restore bounds only if previous state is normal.
40 DCHECK(window->GetProperty(aura::kRestoreBoundsKey) == NULL);
41 SetRestoreBounds(window, window->GetTargetBounds());
42 }
43
44 layout_manager_->set_ignore_calculate_bounds(true);
45 layout_manager_->workspace_manager()->FindBy(window)->Layout(NULL, window);
46 layout_manager_->set_ignore_calculate_bounds(false);
47 }
48
49 } // namespace internal
50 } // namespace aura_shell
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698