| 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/views/mus/window_manager_connection.h" | 5 #include "ui/views/mus/window_manager_connection.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/threading/thread_local.h" | 10 #include "base/threading/thread_local.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 using WindowManagerConnectionPtr = | 24 using WindowManagerConnectionPtr = |
| 25 base::ThreadLocalPointer<views::WindowManagerConnection>; | 25 base::ThreadLocalPointer<views::WindowManagerConnection>; |
| 26 | 26 |
| 27 // Env is thread local so that aura may be used on multiple threads. | 27 // Env is thread local so that aura may be used on multiple threads. |
| 28 base::LazyInstance<WindowManagerConnectionPtr>::Leaky lazy_tls_ptr = | 28 base::LazyInstance<WindowManagerConnectionPtr>::Leaky lazy_tls_ptr = |
| 29 LAZY_INSTANCE_INITIALIZER; | 29 LAZY_INSTANCE_INITIALIZER; |
| 30 | 30 |
| 31 } // namespace | 31 } // namespace |
| 32 | 32 |
| 33 // static | 33 // static |
| 34 void WindowManagerConnection::Create(mojo::Connector* connector) { | 34 void WindowManagerConnection::Create(shell::Connector* connector) { |
| 35 DCHECK(!lazy_tls_ptr.Pointer()->Get()); | 35 DCHECK(!lazy_tls_ptr.Pointer()->Get()); |
| 36 lazy_tls_ptr.Pointer()->Set(new WindowManagerConnection(connector)); | 36 lazy_tls_ptr.Pointer()->Set(new WindowManagerConnection(connector)); |
| 37 } | 37 } |
| 38 | 38 |
| 39 // static | 39 // static |
| 40 WindowManagerConnection* WindowManagerConnection::Get() { | 40 WindowManagerConnection* WindowManagerConnection::Get() { |
| 41 WindowManagerConnection* connection = lazy_tls_ptr.Pointer()->Get(); | 41 WindowManagerConnection* connection = lazy_tls_ptr.Pointer()->Get(); |
| 42 DCHECK(connection); | 42 DCHECK(connection); |
| 43 return connection; | 43 return connection; |
| 44 } | 44 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 62 NativeWidget* WindowManagerConnection::CreateNativeWidgetMus( | 62 NativeWidget* WindowManagerConnection::CreateNativeWidgetMus( |
| 63 const std::map<std::string, std::vector<uint8_t>>& props, | 63 const std::map<std::string, std::vector<uint8_t>>& props, |
| 64 const Widget::InitParams& init_params, | 64 const Widget::InitParams& init_params, |
| 65 internal::NativeWidgetDelegate* delegate) { | 65 internal::NativeWidgetDelegate* delegate) { |
| 66 std::map<std::string, std::vector<uint8_t>> properties = props; | 66 std::map<std::string, std::vector<uint8_t>> properties = props; |
| 67 NativeWidgetMus::ConfigurePropertiesForNewWindow(init_params, &properties); | 67 NativeWidgetMus::ConfigurePropertiesForNewWindow(init_params, &properties); |
| 68 return new NativeWidgetMus(delegate, connector_, NewWindow(properties), | 68 return new NativeWidgetMus(delegate, connector_, NewWindow(properties), |
| 69 mus::mojom::SurfaceType::DEFAULT); | 69 mus::mojom::SurfaceType::DEFAULT); |
| 70 } | 70 } |
| 71 | 71 |
| 72 WindowManagerConnection::WindowManagerConnection(mojo::Connector* connector) | 72 WindowManagerConnection::WindowManagerConnection(shell::Connector* connector) |
| 73 : connector_(connector), window_tree_connection_(nullptr) { | 73 : connector_(connector), window_tree_connection_(nullptr) { |
| 74 window_tree_connection_.reset( | 74 window_tree_connection_.reset( |
| 75 mus::WindowTreeConnection::Create(this, connector_)); | 75 mus::WindowTreeConnection::Create(this, connector_)); |
| 76 | 76 |
| 77 screen_.reset(new ScreenMus(this)); | 77 screen_.reset(new ScreenMus(this)); |
| 78 screen_->Init(connector); | 78 screen_->Init(connector); |
| 79 | 79 |
| 80 // TODO(sad): We should have a DeviceDataManager implementation that talks to | 80 // TODO(sad): We should have a DeviceDataManager implementation that talks to |
| 81 // a mojo service to learn about the input-devices on the system. | 81 // a mojo service to learn about the input-devices on the system. |
| 82 // http://crbug.com/601981 | 82 // http://crbug.com/601981 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 100 | 100 |
| 101 void WindowManagerConnection::OnConnectionLost( | 101 void WindowManagerConnection::OnConnectionLost( |
| 102 mus::WindowTreeConnection* connection) {} | 102 mus::WindowTreeConnection* connection) {} |
| 103 | 103 |
| 104 void WindowManagerConnection::OnWindowManagerFrameValuesChanged() { | 104 void WindowManagerConnection::OnWindowManagerFrameValuesChanged() { |
| 105 if (window_tree_connection_) | 105 if (window_tree_connection_) |
| 106 NativeWidgetMus::NotifyFrameChanged(window_tree_connection_.get()); | 106 NativeWidgetMus::NotifyFrameChanged(window_tree_connection_.get()); |
| 107 } | 107 } |
| 108 | 108 |
| 109 } // namespace views | 109 } // namespace views |
| OLD | NEW |