| 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/native_widget_mus.h" | 5 #include "ui/views/mus/native_widget_mus.h" |
| 6 | 6 |
| 7 #include "base/thread_task_runner_handle.h" | 7 #include "base/thread_task_runner_handle.h" |
| 8 #include "components/mus/public/cpp/property_type_converters.h" | 8 #include "components/mus/public/cpp/property_type_converters.h" |
| 9 #include "components/mus/public/cpp/window.h" | 9 #include "components/mus/public/cpp/window.h" |
| 10 #include "mojo/converters/geometry/geometry_type_converters.h" | 10 #include "mojo/converters/geometry/geometry_type_converters.h" |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 void NativeWidgetMus::InitNativeWidget(const Widget::InitParams& params) { | 252 void NativeWidgetMus::InitNativeWidget(const Widget::InitParams& params) { |
| 253 ownership_ = params.ownership; | 253 ownership_ = params.ownership; |
| 254 window_->SetCanFocus(params.activatable == | 254 window_->SetCanFocus(params.activatable == |
| 255 Widget::InitParams::ACTIVATABLE_YES); | 255 Widget::InitParams::ACTIVATABLE_YES); |
| 256 | 256 |
| 257 // WindowTreeHost creates the compositor using the ContextFactory from | 257 // WindowTreeHost creates the compositor using the ContextFactory from |
| 258 // aura::Env. Install |context_factory_| there so that |context_factory_| is | 258 // aura::Env. Install |context_factory_| there so that |context_factory_| is |
| 259 // picked up. | 259 // picked up. |
| 260 ui::ContextFactory* default_context_factory = | 260 ui::ContextFactory* default_context_factory = |
| 261 aura::Env::GetInstance()->context_factory(); | 261 aura::Env::GetInstance()->context_factory(); |
| 262 aura::Env::GetInstance()->set_context_factory(context_factory_.get()); | 262 // For Chrome, we need the GpuProcessTransportFactory so that renderer and |
| 263 // browser pixels are composited into a single backing |
| 264 // SoftwareOutputDeviceMus. |
| 265 if (!default_context_factory) |
| 266 aura::Env::GetInstance()->set_context_factory(context_factory_.get()); |
| 263 window_tree_host_.reset( | 267 window_tree_host_.reset( |
| 264 new WindowTreeHostMus(shell_, this, window_, surface_type_)); | 268 new WindowTreeHostMus(shell_, this, window_, surface_type_)); |
| 265 window_tree_host_->InitHost(); | 269 window_tree_host_->InitHost(); |
| 266 aura::Env::GetInstance()->set_context_factory(default_context_factory); | 270 aura::Env::GetInstance()->set_context_factory(default_context_factory); |
| 267 DCHECK_EQ(context_factory_.get(), | |
| 268 window_tree_host_->compositor()->context_factory()); | |
| 269 | 271 |
| 270 focus_client_.reset(new wm::FocusController(new FocusRulesImpl)); | 272 focus_client_.reset(new wm::FocusController(new FocusRulesImpl)); |
| 271 | 273 |
| 272 aura::client::SetFocusClient(window_tree_host_->window(), | 274 aura::client::SetFocusClient(window_tree_host_->window(), |
| 273 focus_client_.get()); | 275 focus_client_.get()); |
| 274 aura::client::SetActivationClient(window_tree_host_->window(), | 276 aura::client::SetActivationClient(window_tree_host_->window(), |
| 275 focus_client_.get()); | 277 focus_client_.get()); |
| 276 window_tree_client_.reset( | 278 window_tree_client_.reset( |
| 277 new NativeWidgetMusWindowTreeClient(window_tree_host_->window())); | 279 new NativeWidgetMusWindowTreeClient(window_tree_host_->window())); |
| 278 window_tree_host_->window()->AddPreTargetHandler(focus_client_.get()); | 280 window_tree_host_->window()->AddPreTargetHandler(focus_client_.get()); |
| (...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 770 } else { | 772 } else { |
| 771 native_widget_delegate_->OnScrollEvent(event); | 773 native_widget_delegate_->OnScrollEvent(event); |
| 772 } | 774 } |
| 773 } | 775 } |
| 774 | 776 |
| 775 void NativeWidgetMus::OnGestureEvent(ui::GestureEvent* event) { | 777 void NativeWidgetMus::OnGestureEvent(ui::GestureEvent* event) { |
| 776 native_widget_delegate_->OnGestureEvent(event); | 778 native_widget_delegate_->OnGestureEvent(event); |
| 777 } | 779 } |
| 778 | 780 |
| 779 } // namespace views | 781 } // namespace views |
| OLD | NEW |