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

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

Issue 8414035: Makes DefaultContainerLayoutManager ignore windows with transient (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add test 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
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 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 "ui/aura_shell/default_container_layout_manager.h" 5 #include "ui/aura_shell/default_container_layout_manager.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "ui/aura/desktop.h" 8 #include "ui/aura/desktop.h"
9 #include "ui/aura/event.h" 9 #include "ui/aura/event.h"
10 #include "ui/aura/window.h" 10 #include "ui/aura/window.h"
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 //////////////////////////////////////////////////////////////////////////////// 95 ////////////////////////////////////////////////////////////////////////////////
96 // DefaultContainerLayoutManager, aura::LayoutManager implementation: 96 // DefaultContainerLayoutManager, aura::LayoutManager implementation:
97 97
98 void DefaultContainerLayoutManager::OnWindowResized() { 98 void DefaultContainerLayoutManager::OnWindowResized() {
99 // Workspace is updated via DesktopObserver::OnDesktopResized. 99 // Workspace is updated via DesktopObserver::OnDesktopResized.
100 } 100 }
101 101
102 void DefaultContainerLayoutManager::OnWindowAdded(aura::Window* child) { 102 void DefaultContainerLayoutManager::OnWindowAdded(aura::Window* child) {
103 intptr_t type = reinterpret_cast<intptr_t>( 103 intptr_t type = reinterpret_cast<intptr_t>(
104 ui::ViewProp::GetValue(child, views::NativeWidgetAura::kWindowTypeKey)); 104 ui::ViewProp::GetValue(child, views::NativeWidgetAura::kWindowTypeKey));
105 if (type != views::Widget::InitParams::TYPE_WINDOW) 105 if (type != views::Widget::InitParams::TYPE_WINDOW ||
106 child->transient_parent())
106 return; 107 return;
107 108
108 AutoReset<bool> reset(&ignore_calculate_bounds_, true); 109 AutoReset<bool> reset(&ignore_calculate_bounds_, true);
109 110
110 Workspace* workspace = workspace_manager_->GetActiveWorkspace(); 111 Workspace* workspace = workspace_manager_->GetActiveWorkspace();
111 if (workspace) { 112 if (workspace) {
112 aura::Window* active = aura::Desktop::GetInstance()->active_window(); 113 aura::Window* active = aura::Desktop::GetInstance()->active_window();
113 // Active window may not be in the default container layer. 114 // Active window may not be in the default container layer.
114 if (!workspace->Contains(active)) 115 if (!workspace->Contains(active))
115 active = NULL; 116 active = NULL;
(...skipping 21 matching lines...) Expand all
137 bool visible) { 138 bool visible) {
138 NOTIMPLEMENTED(); 139 NOTIMPLEMENTED();
139 } 140 }
140 141
141 void DefaultContainerLayoutManager::CalculateBoundsForChild( 142 void DefaultContainerLayoutManager::CalculateBoundsForChild(
142 aura::Window* child, 143 aura::Window* child,
143 gfx::Rect* requested_bounds) { 144 gfx::Rect* requested_bounds) {
144 intptr_t type = reinterpret_cast<intptr_t>( 145 intptr_t type = reinterpret_cast<intptr_t>(
145 ui::ViewProp::GetValue(child, views::NativeWidgetAura::kWindowTypeKey)); 146 ui::ViewProp::GetValue(child, views::NativeWidgetAura::kWindowTypeKey));
146 if (type != views::Widget::InitParams::TYPE_WINDOW || 147 if (type != views::Widget::InitParams::TYPE_WINDOW ||
147 ignore_calculate_bounds_) 148 ignore_calculate_bounds_ || child->transient_parent())
148 return; 149 return;
149 150
150 // If a drag window is requesting bounds, make sure its attached to 151 // If a drag window is requesting bounds, make sure its attached to
151 // the workarea's top and fits within the total drag area. 152 // the workarea's top and fits within the total drag area.
152 if (drag_window_) { 153 if (drag_window_) {
153 gfx::Rect drag_area = workspace_manager_->GetDragAreaBounds(); 154 gfx::Rect drag_area = workspace_manager_->GetDragAreaBounds();
154 requested_bounds->set_y(drag_area.y()); 155 requested_bounds->set_y(drag_area.y());
155 *requested_bounds = requested_bounds->AdjustToFit(drag_area); 156 *requested_bounds = requested_bounds->AdjustToFit(drag_area);
156 return; 157 return;
157 } 158 }
158 159
159 Workspace* workspace = workspace_manager_->FindBy(child); 160 Workspace* workspace = workspace_manager_->FindBy(child);
160 gfx::Rect work_area = workspace->GetWorkAreaBounds(); 161 gfx::Rect work_area = workspace->GetWorkAreaBounds();
161 requested_bounds->set_origin( 162 requested_bounds->set_origin(
162 gfx::Point(child->GetTargetBounds().x(), work_area.y())); 163 gfx::Point(child->GetTargetBounds().x(), work_area.y()));
163 *requested_bounds = requested_bounds->AdjustToFit(work_area); 164 *requested_bounds = requested_bounds->AdjustToFit(work_area);
164 } 165 }
165 166
166 } // namespace internal 167 } // namespace internal
167 } // namespace aura_shell 168 } // namespace aura_shell
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698