OLD | NEW |
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/string_util.h" | 8 #include "base/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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 // will be added to the same display as the parent. | 129 // will be added to the same display as the parent. |
130 gfx::Rect bounds = gfx::Screen::GetScreenFor(parent)-> | 130 gfx::Rect bounds = gfx::Screen::GetScreenFor(parent)-> |
131 GetDisplayNearestWindow(parent).bounds(); | 131 GetDisplayNearestWindow(parent).bounds(); |
132 window_bounds.set_origin(bounds.origin()); | 132 window_bounds.set_origin(bounds.origin()); |
133 } | 133 } |
134 } | 134 } |
135 | 135 |
136 if (parent) { | 136 if (parent) { |
137 parent->AddChild(window_); | 137 parent->AddChild(window_); |
138 } else { | 138 } else { |
139 // TODO(erg): Once I've threaded context through chrome, uncomment this | 139 window_->SetDefaultParentByRootWindow(context->GetRootWindow(), |
140 // check, which currently fails on the NULL == NULL case. | 140 window_bounds); |
141 // | |
142 // DCHECK_NE(params.GetParent(), params.context); | |
143 | |
144 // TODO(erg): Remove this NULL check once we've made everything in views | |
145 // actually pass us a context. | |
146 aura::RootWindow* root_window = context ? context->GetRootWindow() : NULL; | |
147 window_->SetDefaultParentByRootWindow(root_window, window_bounds); | |
148 } | 141 } |
149 | 142 |
150 // Wait to set the bounds until we have a parent. That way we can know our | 143 // Wait to set the bounds until we have a parent. That way we can know our |
151 // true state/bounds (the LayoutManager may enforce a particular | 144 // true state/bounds (the LayoutManager may enforce a particular |
152 // state/bounds). | 145 // state/bounds). |
153 if (IsMaximized()) | 146 if (IsMaximized()) |
154 SetRestoreBounds(window_, window_bounds); | 147 SetRestoreBounds(window_, window_bounds); |
155 else | 148 else |
156 SetBounds(window_bounds); | 149 SetBounds(window_bounds); |
157 window_->set_ignore_events(!params.accept_events); | 150 window_->set_ignore_events(!params.accept_events); |
(...skipping 899 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1057 return aura::Env::GetInstance()->is_mouse_button_down(); | 1050 return aura::Env::GetInstance()->is_mouse_button_down(); |
1058 } | 1051 } |
1059 | 1052 |
1060 // static | 1053 // static |
1061 bool NativeWidgetPrivate::IsTouchDown() { | 1054 bool NativeWidgetPrivate::IsTouchDown() { |
1062 return aura::Env::GetInstance()->is_touch_down(); | 1055 return aura::Env::GetInstance()->is_touch_down(); |
1063 } | 1056 } |
1064 | 1057 |
1065 } // namespace internal | 1058 } // namespace internal |
1066 } // namespace views | 1059 } // namespace views |
OLD | NEW |