| 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/aura/test/test_windows.h" | 5 #include "ui/aura/test/test_windows.h" |
| 6 | 6 |
| 7 #include "base/string_number_conversions.h" | 7 #include "base/string_number_conversions.h" |
| 8 #include "ui/aura/client/aura_constants.h" | 8 #include "ui/aura/client/aura_constants.h" |
| 9 #include "ui/aura/window.h" | 9 #include "ui/aura/window.h" |
| 10 #include "ui/compositor/layer.h" | 10 #include "ui/compositor/layer.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 client::WindowType type, | 45 client::WindowType type, |
| 46 int id, | 46 int id, |
| 47 const gfx::Rect& bounds, | 47 const gfx::Rect& bounds, |
| 48 Window* parent) { | 48 Window* parent) { |
| 49 Window* window = new Window(delegate); | 49 Window* window = new Window(delegate); |
| 50 window->set_id(id); | 50 window->set_id(id); |
| 51 window->SetType(type); | 51 window->SetType(type); |
| 52 window->Init(ui::LAYER_TEXTURED); | 52 window->Init(ui::LAYER_TEXTURED); |
| 53 window->SetBounds(bounds); | 53 window->SetBounds(bounds); |
| 54 window->Show(); | 54 window->Show(); |
| 55 window->SetParent(parent); | 55 parent->AddChild(window); |
| 56 window->SetProperty(aura::client::kCanMaximizeKey, true); | 56 window->SetProperty(aura::client::kCanMaximizeKey, true); |
| 57 return window; | 57 return window; |
| 58 } | 58 } |
| 59 | 59 |
| 60 Window* CreateTransientChild(int id, Window* parent) { | |
| 61 Window* window = new Window(NULL); | |
| 62 window->set_id(id); | |
| 63 window->SetType(aura::client::WINDOW_TYPE_NORMAL); | |
| 64 window->Init(ui::LAYER_TEXTURED); | |
| 65 window->SetParent(NULL); | |
| 66 parent->AddTransientChild(window); | |
| 67 return window; | |
| 68 } | |
| 69 | |
| 70 template <typename T> | 60 template <typename T> |
| 71 bool ObjectIsAbove(T* upper, T* lower) { | 61 bool ObjectIsAbove(T* upper, T* lower) { |
| 72 DCHECK_EQ(upper->parent(), lower->parent()); | 62 DCHECK_EQ(upper->parent(), lower->parent()); |
| 73 DCHECK_NE(upper, lower); | 63 DCHECK_NE(upper, lower); |
| 74 const std::vector<T*>& children = upper->parent()->children(); | 64 const std::vector<T*>& children = upper->parent()->children(); |
| 75 const size_t upper_i = | 65 const size_t upper_i = |
| 76 std::find(children.begin(), children.end(), upper) - children.begin(); | 66 std::find(children.begin(), children.end(), upper) - children.begin(); |
| 77 const size_t lower_i = | 67 const size_t lower_i = |
| 78 std::find(children.begin(), children.end(), lower) - children.begin(); | 68 std::find(children.begin(), children.end(), lower) - children.begin(); |
| 79 return upper_i > lower_i; | 69 return upper_i > lower_i; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 93 i != parent->children().end(); ++i) { | 83 i != parent->children().end(); ++i) { |
| 94 if (!result.empty()) | 84 if (!result.empty()) |
| 95 result += " "; | 85 result += " "; |
| 96 result += base::IntToString((*i)->id()); | 86 result += base::IntToString((*i)->id()); |
| 97 } | 87 } |
| 98 return result; | 88 return result; |
| 99 } | 89 } |
| 100 | 90 |
| 101 } // namespace test | 91 } // namespace test |
| 102 } // namespace aura | 92 } // namespace aura |
| OLD | NEW |