| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/mus/window_tree_host_mus.h" | 5 #include "ui/aura/mus/window_tree_host_mus.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "ui/aura/env.h" | 8 #include "ui/aura/env.h" |
| 9 #include "ui/aura/mus/input_method_mus.h" | 9 #include "ui/aura/mus/input_method_mus.h" |
| 10 #include "ui/aura/mus/window_port_mus.h" | 10 #include "ui/aura/mus/window_port_mus.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 bounds_in_pixels = display_init_params_->viewport_metrics.bounds_in_pixels; | 45 bounds_in_pixels = display_init_params_->viewport_metrics.bounds_in_pixels; |
| 46 window()->SetProperty(kWindowTreeHostMusKey, this); | 46 window()->SetProperty(kWindowTreeHostMusKey, this); |
| 47 // TODO(sky): find a cleaner way to set this! Better solution is to likely | 47 // TODO(sky): find a cleaner way to set this! Better solution is to likely |
| 48 // have constructor take aura::Window. | 48 // have constructor take aura::Window. |
| 49 WindowPortMus* window_mus = WindowPortMus::Get(window()); | 49 WindowPortMus* window_mus = WindowPortMus::Get(window()); |
| 50 window_mus->window_ = window(); | 50 window_mus->window_ = window(); |
| 51 // Apply the properties before initializing the window, that way the server | 51 // Apply the properties before initializing the window, that way the server |
| 52 // seems them at the time the window is created. | 52 // seems them at the time the window is created. |
| 53 for (auto& pair : init_params.properties) | 53 for (auto& pair : init_params.properties) |
| 54 window_mus->SetPropertyFromServer(pair.first, &pair.second); | 54 window_mus->SetPropertyFromServer(pair.first, &pair.second); |
| 55 // TODO(fsamuel): Once the display compositor is decoupled from the browser | 55 CreateCompositor(cc::FrameSinkId()); |
| 56 // process then ui::Compositor will not a cc::FrameSinkId. | |
| 57 CreateCompositor(init_params.frame_sink_id); | |
| 58 gfx::AcceleratedWidget accelerated_widget; | 56 gfx::AcceleratedWidget accelerated_widget; |
| 59 // We need accelerated widget numbers to be different for each | 57 // We need accelerated widget numbers to be different for each |
| 60 // window and fit in the smallest sizeof(AcceleratedWidget) uint32_t | 58 // window and fit in the smallest sizeof(AcceleratedWidget) uint32_t |
| 61 // has this property. | 59 // has this property. |
| 62 #if defined(OS_WIN) || defined(OS_ANDROID) | 60 #if defined(OS_WIN) || defined(OS_ANDROID) |
| 63 accelerated_widget = | 61 accelerated_widget = |
| 64 reinterpret_cast<gfx::AcceleratedWidget>(accelerated_widget_count++); | 62 reinterpret_cast<gfx::AcceleratedWidget>(accelerated_widget_count++); |
| 65 #else | 63 #else |
| 66 accelerated_widget = | 64 accelerated_widget = |
| 67 static_cast<gfx::AcceleratedWidget>(accelerated_widget_count++); | 65 static_cast<gfx::AcceleratedWidget>(accelerated_widget_count++); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 79 if (!init_params.use_classic_ime) { | 77 if (!init_params.use_classic_ime) { |
| 80 input_method_ = base::MakeUnique<InputMethodMus>(this, window()); | 78 input_method_ = base::MakeUnique<InputMethodMus>(this, window()); |
| 81 input_method_->Init(init_params.window_tree_client->connector()); | 79 input_method_->Init(init_params.window_tree_client->connector()); |
| 82 SetSharedInputMethod(input_method_.get()); | 80 SetSharedInputMethod(input_method_.get()); |
| 83 } | 81 } |
| 84 | 82 |
| 85 compositor()->SetHostHasTransparentBackground(true); | 83 compositor()->SetHostHasTransparentBackground(true); |
| 86 | 84 |
| 87 // Mus windows are assumed hidden. | 85 // Mus windows are assumed hidden. |
| 88 compositor()->SetVisible(false); | 86 compositor()->SetVisible(false); |
| 89 | |
| 90 if (init_params.frame_sink_id.is_valid()) | |
| 91 window_mus->SetFrameSinkIdFromServer(init_params.frame_sink_id); | |
| 92 } | 87 } |
| 93 | 88 |
| 94 WindowTreeHostMus::~WindowTreeHostMus() { | 89 WindowTreeHostMus::~WindowTreeHostMus() { |
| 95 DestroyCompositor(); | 90 DestroyCompositor(); |
| 96 DestroyDispatcher(); | 91 DestroyDispatcher(); |
| 97 } | 92 } |
| 98 | 93 |
| 99 // static | 94 // static |
| 100 WindowTreeHostMus* WindowTreeHostMus::ForWindow(aura::Window* window) { | 95 WindowTreeHostMus* WindowTreeHostMus::ForWindow(aura::Window* window) { |
| 101 if (!window) | 96 if (!window) |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 void WindowTreeHostMus::MoveCursorToScreenLocationInPixels( | 201 void WindowTreeHostMus::MoveCursorToScreenLocationInPixels( |
| 207 const gfx::Point& location_in_pixels) { | 202 const gfx::Point& location_in_pixels) { |
| 208 // TODO: this needs to message the server http://crbug.com/693340. Setting | 203 // TODO: this needs to message the server http://crbug.com/693340. Setting |
| 209 // the location is really only appropriate in tests, outside of tests this | 204 // the location is really only appropriate in tests, outside of tests this |
| 210 // value is ignored. | 205 // value is ignored. |
| 211 NOTIMPLEMENTED(); | 206 NOTIMPLEMENTED(); |
| 212 Env::GetInstance()->set_last_mouse_location(location_in_pixels); | 207 Env::GetInstance()->set_last_mouse_location(location_in_pixels); |
| 213 } | 208 } |
| 214 | 209 |
| 215 } // namespace aura | 210 } // namespace aura |
| OLD | NEW |