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

Side by Side Diff: ui/views/widget/native_widget_aura.cc

Issue 196063002: Move wm/core to wm namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 9 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
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 "ui/views/widget/native_widget_aura.h" 5 #include "ui/views/widget/native_widget_aura.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "third_party/skia/include/core/SkRegion.h" 9 #include "third_party/skia/include/core/SkRegion.h"
10 #include "ui/aura/client/activation_client.h" 10 #include "ui/aura/client/activation_client.h"
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 125
126 delegate_->OnNativeWidgetCreated(false); 126 delegate_->OnNativeWidgetCreated(false);
127 127
128 gfx::Rect window_bounds = params.bounds; 128 gfx::Rect window_bounds = params.bounds;
129 gfx::NativeView parent = params.parent; 129 gfx::NativeView parent = params.parent;
130 gfx::NativeView context = params.context; 130 gfx::NativeView context = params.context;
131 if (!params.child) { 131 if (!params.child) {
132 // Set up the transient child before the window is added. This way the 132 // Set up the transient child before the window is added. This way the
133 // LayoutManager knows the window has a transient parent. 133 // LayoutManager knows the window has a transient parent.
134 if (parent && parent->type() != ui::wm::WINDOW_TYPE_UNKNOWN) { 134 if (parent && parent->type() != ui::wm::WINDOW_TYPE_UNKNOWN) {
135 corewm::AddTransientChild(parent, window_); 135 wm::AddTransientChild(parent, window_);
136 if (!context) 136 if (!context)
137 context = parent; 137 context = parent;
138 parent = NULL; 138 parent = NULL;
139 } 139 }
140 // SetAlwaysOnTop before SetParent so that always-on-top container is used. 140 // SetAlwaysOnTop before SetParent so that always-on-top container is used.
141 SetAlwaysOnTop(params.keep_on_top); 141 SetAlwaysOnTop(params.keep_on_top);
142 // Make sure we have a real |window_bounds|. 142 // Make sure we have a real |window_bounds|.
143 if (parent && window_bounds == gfx::Rect()) { 143 if (parent && window_bounds == gfx::Rect()) {
144 // If a parent is specified but no bounds are given, 144 // If a parent is specified but no bounds are given,
145 // use the origin of the parent's display so that the widget 145 // use the origin of the parent's display so that the widget
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 gfx::Point origin = work_area.origin(); 308 gfx::Point origin = work_area.origin();
309 screen_position_client->ConvertPointFromScreen(window_->GetRootWindow(), 309 screen_position_client->ConvertPointFromScreen(window_->GetRootWindow(),
310 &origin); 310 &origin);
311 work_area.set_origin(origin); 311 work_area.set_origin(origin);
312 } 312 }
313 313
314 parent_bounds.Intersect(work_area); 314 parent_bounds.Intersect(work_area);
315 315
316 // If |window_|'s transient parent's bounds are big enough to fit it, then we 316 // If |window_|'s transient parent's bounds are big enough to fit it, then we
317 // center it with respect to the transient parent. 317 // center it with respect to the transient parent.
318 if (views::corewm::GetTransientParent(window_)) { 318 if (wm::GetTransientParent(window_)) {
319 gfx::Rect transient_parent_rect = 319 gfx::Rect transient_parent_rect =
320 views::corewm::GetTransientParent(window_)->GetBoundsInRootWindow(); 320 wm::GetTransientParent(window_)->GetBoundsInRootWindow();
321 transient_parent_rect.Intersect(work_area); 321 transient_parent_rect.Intersect(work_area);
322 if (transient_parent_rect.height() >= size.height() && 322 if (transient_parent_rect.height() >= size.height() &&
323 transient_parent_rect.width() >= size.width()) 323 transient_parent_rect.width() >= size.width())
324 parent_bounds = transient_parent_rect; 324 parent_bounds = transient_parent_rect;
325 } 325 }
326 326
327 gfx::Rect window_bounds( 327 gfx::Rect window_bounds(
328 parent_bounds.x() + (parent_bounds.width() - size.width()) / 2, 328 parent_bounds.x() + (parent_bounds.width() - size.width()) / 2,
329 parent_bounds.y() + (parent_bounds.height() - size.height()) / 2, 329 parent_bounds.y() + (parent_bounds.height() - size.height()) / 2,
330 size.width(), 330 size.width(),
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 } 516 }
517 517
518 void NativeWidgetAura::Deactivate() { 518 void NativeWidgetAura::Deactivate() {
519 if (!window_) 519 if (!window_)
520 return; 520 return;
521 aura::client::GetActivationClient(window_->GetRootWindow())->DeactivateWindow( 521 aura::client::GetActivationClient(window_->GetRootWindow())->DeactivateWindow(
522 window_); 522 window_);
523 } 523 }
524 524
525 bool NativeWidgetAura::IsActive() const { 525 bool NativeWidgetAura::IsActive() const {
526 return window_ && corewm::IsActiveWindow(window_); 526 return window_ && wm::IsActiveWindow(window_);
527 } 527 }
528 528
529 void NativeWidgetAura::SetAlwaysOnTop(bool on_top) { 529 void NativeWidgetAura::SetAlwaysOnTop(bool on_top) {
530 if (window_) 530 if (window_)
531 window_->SetProperty(aura::client::kAlwaysOnTopKey, on_top); 531 window_->SetProperty(aura::client::kAlwaysOnTopKey, on_top);
532 } 532 }
533 533
534 bool NativeWidgetAura::IsAlwaysOnTop() const { 534 bool NativeWidgetAura::IsAlwaysOnTop() const {
535 return window_ && window_->GetProperty(aura::client::kAlwaysOnTopKey); 535 return window_ && window_->GetProperty(aura::client::kAlwaysOnTopKey);
536 } 536 }
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after
1076 for (aura::Window::Windows::const_iterator i = child_windows.begin(); 1076 for (aura::Window::Windows::const_iterator i = child_windows.begin();
1077 i != child_windows.end(); ++i) { 1077 i != child_windows.end(); ++i) {
1078 GetAllChildWidgets((*i), children); 1078 GetAllChildWidgets((*i), children);
1079 } 1079 }
1080 } 1080 }
1081 1081
1082 // static 1082 // static
1083 void NativeWidgetPrivate::GetAllOwnedWidgets(gfx::NativeView native_view, 1083 void NativeWidgetPrivate::GetAllOwnedWidgets(gfx::NativeView native_view,
1084 Widget::Widgets* owned) { 1084 Widget::Widgets* owned) {
1085 const aura::Window::Windows& transient_children = 1085 const aura::Window::Windows& transient_children =
1086 views::corewm::GetTransientChildren(native_view); 1086 wm::GetTransientChildren(native_view);
1087 for (aura::Window::Windows::const_iterator i = transient_children.begin(); 1087 for (aura::Window::Windows::const_iterator i = transient_children.begin();
1088 i != transient_children.end(); ++i) { 1088 i != transient_children.end(); ++i) {
1089 NativeWidgetPrivate* native_widget = static_cast<NativeWidgetPrivate*>( 1089 NativeWidgetPrivate* native_widget = static_cast<NativeWidgetPrivate*>(
1090 GetNativeWidgetForNativeView(*i)); 1090 GetNativeWidgetForNativeView(*i));
1091 if (native_widget && native_widget->GetWidget()) 1091 if (native_widget && native_widget->GetWidget())
1092 owned->insert(native_widget->GetWidget()); 1092 owned->insert(native_widget->GetWidget());
1093 GetAllOwnedWidgets((*i), owned); 1093 GetAllOwnedWidgets((*i), owned);
1094 } 1094 }
1095 } 1095 }
1096 1096
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
1144 return aura::Env::GetInstance()->IsMouseButtonDown(); 1144 return aura::Env::GetInstance()->IsMouseButtonDown();
1145 } 1145 }
1146 1146
1147 // static 1147 // static
1148 bool NativeWidgetPrivate::IsTouchDown() { 1148 bool NativeWidgetPrivate::IsTouchDown() {
1149 return aura::Env::GetInstance()->is_touch_down(); 1149 return aura::Env::GetInstance()->is_touch_down();
1150 } 1150 }
1151 1151
1152 } // namespace internal 1152 } // namespace internal
1153 } // namespace views 1153 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc ('k') | ui/views/window/dialog_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698