Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
|
James Cook
2016/05/19 05:08:22
nit: 2016
sky
2016/05/19 15:14:24
Done.
| |
| 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 "mash/wm/test/wm_test_helper.h" | |
| 6 | |
| 7 #include "base/message_loop/message_loop.h" | |
| 8 #include "components/mus/public/cpp/property_type_converters.h" | |
| 9 #include "components/mus/public/cpp/window_tree_connection.h" | |
| 10 #include "mash/wm/root_window_controller.h" | |
| 11 #include "mash/wm/test/wm_test_screen.h" | |
| 12 #include "mash/wm/window_manager.h" | |
| 13 #include "mash/wm/window_manager.h" | |
| 14 #include "mash/wm/window_manager_application.h" | |
| 15 #include "ui/display/display.h" | |
| 16 | |
| 17 namespace mash { | |
| 18 namespace wm { | |
| 19 | |
| 20 WmTestHelper::WmTestHelper() {} | |
| 21 | |
| 22 WmTestHelper::~WmTestHelper() {} | |
| 23 | |
| 24 void WmTestHelper::Init() { | |
| 25 message_loop_.reset(new base::MessageLoopForUI()); | |
| 26 const uint32_t app_id = 1; | |
| 27 window_manager_app_.Initialize(nullptr, shell::Identity(), app_id); | |
| 28 screen_ = new WmTestScreen; | |
| 29 window_manager_app_.screen_.reset(screen_); | |
| 30 | |
| 31 // RootWindowController controls its own lifetime. | |
| 32 RootWindowController* root_window_controller = | |
| 33 new RootWindowController(&window_manager_app_); | |
| 34 // Need an id other than kInvalidDisplayID so the Display is considered valid. | |
| 35 root_window_controller->display_.set_id(1); | |
| 36 const gfx::Rect display_bounds(0, 0, 800, 600); | |
| 37 root_window_controller->display_.set_bounds(display_bounds); | |
| 38 const gfx::Rect work_area(0, 0, display_bounds.width(), | |
| 39 display_bounds.height() - 20); | |
|
James Cook
2016/05/19 05:08:22
optional: maybe a constant for the magic -20?
sky
2016/05/19 15:14:24
I added a comment. I don't think it's worth the co
| |
| 40 root_window_controller->display_.set_work_area(work_area); | |
| 41 | |
| 42 screen_->display_list()->AddDisplay(root_window_controller->display(), | |
| 43 views::DisplayList::Type::PRIMARY); | |
| 44 | |
| 45 window_tree_connection_setup_.Init( | |
| 46 root_window_controller, root_window_controller->window_manager_.get()); | |
| 47 root_window_controller->root()->SetBounds(display_bounds); | |
| 48 window_manager_app_.AddRootWindowController(root_window_controller); | |
| 49 } | |
| 50 | |
| 51 } // namespace wm | |
| 52 } // namespace mash | |
| OLD | NEW |