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

Side by Side Diff: ash/wm/window_util.cc

Issue 10837211: Draw web content area correctly on a phantom window for window dragging (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove WindowPainter Created 8 years, 4 months 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 | « ash/wm/window_util.h ('k') | ash/wm/workspace/phantom_window_controller.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ash/wm/window_util.h" 5 #include "ash/wm/window_util.h"
6 6
7 #include <vector>
8
7 #include "ash/shell.h" 9 #include "ash/shell.h"
8 #include "ash/wm/activation_controller.h" 10 #include "ash/wm/activation_controller.h"
9 #include "ash/wm/window_properties.h" 11 #include "ash/wm/window_properties.h"
10 #include "ui/aura/client/activation_client.h" 12 #include "ui/aura/client/activation_client.h"
11 #include "ui/aura/client/aura_constants.h" 13 #include "ui/aura/client/aura_constants.h"
12 #include "ui/aura/root_window.h" 14 #include "ui/aura/root_window.h"
13 #include "ui/aura/window.h" 15 #include "ui/aura/window.h"
14 #include "ui/base/ui_base_types.h" 16 #include "ui/base/ui_base_types.h"
17 #include "ui/compositor/layer.h"
15 #include "ui/gfx/display.h" 18 #include "ui/gfx/display.h"
16 #include "ui/gfx/screen.h" 19 #include "ui/gfx/screen.h"
17 20
18 namespace ash { 21 namespace ash {
19 namespace wm { 22 namespace wm {
20 23
21 void ActivateWindow(aura::Window* window) { 24 void ActivateWindow(aura::Window* window) {
22 DCHECK(window); 25 DCHECK(window);
23 DCHECK(window->GetRootWindow()); 26 DCHECK(window->GetRootWindow());
24 aura::client::GetActivationClient(window->GetRootWindow())->ActivateWindow( 27 aura::client::GetActivationClient(window->GetRootWindow())->ActivateWindow(
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 void RestoreWindow(aura::Window* window) { 95 void RestoreWindow(aura::Window* window) {
93 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); 96 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL);
94 } 97 }
95 98
96 void CenterWindow(aura::Window* window) { 99 void CenterWindow(aura::Window* window) {
97 const gfx::Display display = gfx::Screen::GetDisplayNearestWindow(window); 100 const gfx::Display display = gfx::Screen::GetDisplayNearestWindow(window);
98 gfx::Rect center = display.work_area().Center(window->bounds().size()); 101 gfx::Rect center = display.work_area().Center(window->bounds().size());
99 window->SetBounds(center); 102 window->SetBounds(center);
100 } 103 }
101 104
105 ui::Layer* RecreateWindowLayers(aura::Window* window) {
106 const gfx::Rect bounds = window->bounds();
107 ui::Layer* old_layer = window->RecreateLayer();
108 DCHECK(old_layer);
109 // Resize the window to the new size, which will force a layout and paint.
110 window->SetBounds(bounds);
111 for (aura::Window::Windows::const_iterator it = window->children().begin();
112 it != window->children().end();
113 ++it) {
114 aura::Window* child = *it;
115 const gfx::Rect child_bounds = child->bounds();
116 ui::Layer* old_child_layer = RecreateWindowLayers(child);
117 // Maintain the hierarchy of the detached layers.
118 old_layer->Add(old_child_layer);
119 child->SetBounds(child_bounds); // Resize the child window too.
120 }
121 return old_layer;
122 }
123
124 void DeepDeleteLayers(ui::Layer* layer) {
125 std::vector<ui::Layer*> children = layer->children();
126 for (std::vector<ui::Layer*>::const_iterator it = children.begin();
127 it != children.end();
128 ++it) {
129 ui::Layer* child = *it;
130 DeepDeleteLayers(child);
131 }
132 delete layer;
133 }
134
102 } // namespace wm 135 } // namespace wm
103 } // namespace ash 136 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/window_util.h ('k') | ash/wm/workspace/phantom_window_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698