| OLD | NEW |
| (Empty) |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "athena/test/base/test_windows.h" | |
| 6 | |
| 7 #include "athena/screen/public/screen_manager.h" | |
| 8 #include "ui/aura/client/aura_constants.h" | |
| 9 #include "ui/aura/client/window_tree_client.h" | |
| 10 #include "ui/aura/window.h" | |
| 11 #include "ui/wm/core/window_util.h" | |
| 12 | |
| 13 namespace athena { | |
| 14 namespace test { | |
| 15 | |
| 16 scoped_ptr<aura::Window> CreateNormalWindow(aura::WindowDelegate* delegate, | |
| 17 aura::Window* parent) { | |
| 18 return CreateWindowWithType(delegate, parent, ui::wm::WINDOW_TYPE_NORMAL); | |
| 19 } | |
| 20 | |
| 21 scoped_ptr<aura::Window> CreateWindowWithType(aura::WindowDelegate* delegate, | |
| 22 aura::Window* parent, | |
| 23 ui::wm::WindowType window_type) { | |
| 24 scoped_ptr<aura::Window> window(new aura::Window(delegate)); | |
| 25 window->SetType(window_type); | |
| 26 window->Init(aura::WINDOW_LAYER_SOLID_COLOR); | |
| 27 if (parent) { | |
| 28 parent->AddChild(window.get()); | |
| 29 } else { | |
| 30 aura::client::ParentWindowWithContext( | |
| 31 window.get(), ScreenManager::Get()->GetContext(), gfx::Rect()); | |
| 32 } | |
| 33 return window.Pass(); | |
| 34 } | |
| 35 | |
| 36 scoped_ptr<aura::Window> CreateTransientWindow(aura::WindowDelegate* delegate, | |
| 37 aura::Window* transient_parent, | |
| 38 ui::ModalType modal_type, | |
| 39 bool top_most) { | |
| 40 scoped_ptr<aura::Window> window(new aura::Window(delegate)); | |
| 41 window->SetType(ui::wm::WINDOW_TYPE_NORMAL); | |
| 42 window->Init(aura::WINDOW_LAYER_SOLID_COLOR); | |
| 43 window->SetProperty(aura::client::kModalKey, modal_type); | |
| 44 window->SetProperty(aura::client::kAlwaysOnTopKey, top_most); | |
| 45 if (transient_parent) | |
| 46 wm::AddTransientChild(transient_parent, window.get()); | |
| 47 aura::client::ParentWindowWithContext( | |
| 48 window.get(), ScreenManager::Get()->GetContext(), gfx::Rect()); | |
| 49 return window.Pass(); | |
| 50 } | |
| 51 | |
| 52 } // namespace test | |
| 53 } // namespace athena | |
| OLD | NEW |