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 window_->SetDefaultParentByRootWindow(context->GetRootWindow(), | 139 // TODO(erg): Once I've threaded context through chrome, uncomment this |
140 window_bounds); | 140 // check, which currently fails on the NULL == NULL case. |
| 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); |
141 } | 148 } |
142 | 149 |
143 // Wait to set the bounds until we have a parent. That way we can know our | 150 // Wait to set the bounds until we have a parent. That way we can know our |
144 // true state/bounds (the LayoutManager may enforce a particular | 151 // true state/bounds (the LayoutManager may enforce a particular |
145 // state/bounds). | 152 // state/bounds). |
146 if (IsMaximized()) | 153 if (IsMaximized()) |
147 SetRestoreBounds(window_, window_bounds); | 154 SetRestoreBounds(window_, window_bounds); |
148 else | 155 else |
149 SetBounds(window_bounds); | 156 SetBounds(window_bounds); |
150 window_->set_ignore_events(!params.accept_events); | 157 window_->set_ignore_events(!params.accept_events); |
(...skipping 899 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1050 return aura::Env::GetInstance()->is_mouse_button_down(); | 1057 return aura::Env::GetInstance()->is_mouse_button_down(); |
1051 } | 1058 } |
1052 | 1059 |
1053 // static | 1060 // static |
1054 bool NativeWidgetPrivate::IsTouchDown() { | 1061 bool NativeWidgetPrivate::IsTouchDown() { |
1055 return aura::Env::GetInstance()->is_touch_down(); | 1062 return aura::Env::GetInstance()->is_touch_down(); |
1056 } | 1063 } |
1057 | 1064 |
1058 } // namespace internal | 1065 } // namespace internal |
1059 } // namespace views | 1066 } // namespace views |
OLD | NEW |