| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/mus_client.h" | 5 #include "ui/views/mus/mus_client.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "base/threading/thread.h" | 9 #include "base/threading/thread.h" |
| 10 #include "services/service_manager/public/cpp/connector.h" | 10 #include "services/service_manager/public/cpp/connector.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 #include "ui/views/mus/desktop_window_tree_host_mus.h" | 26 #include "ui/views/mus/desktop_window_tree_host_mus.h" |
| 27 #include "ui/views/mus/mus_property_mirror.h" | 27 #include "ui/views/mus/mus_property_mirror.h" |
| 28 #include "ui/views/mus/pointer_watcher_event_router.h" | 28 #include "ui/views/mus/pointer_watcher_event_router.h" |
| 29 #include "ui/views/mus/screen_mus.h" | 29 #include "ui/views/mus/screen_mus.h" |
| 30 #include "ui/views/views_delegate.h" | 30 #include "ui/views/views_delegate.h" |
| 31 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" | 31 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" |
| 32 #include "ui/views/widget/widget_delegate.h" | 32 #include "ui/views/widget/widget_delegate.h" |
| 33 #include "ui/wm/core/shadow_types.h" | 33 #include "ui/wm/core/shadow_types.h" |
| 34 #include "ui/wm/core/wm_state.h" | 34 #include "ui/wm/core/wm_state.h" |
| 35 | 35 |
| 36 #if defined(USE_OZONE) |
| 37 #include "ui/base/cursor/ozone/cursor_data_factory_ozone.h" |
| 38 #endif |
| 39 |
| 36 // Widget::InitParams::Type must match that of ui::mojom::WindowType. | 40 // Widget::InitParams::Type must match that of ui::mojom::WindowType. |
| 37 #define WINDOW_TYPES_MATCH(NAME) \ | 41 #define WINDOW_TYPES_MATCH(NAME) \ |
| 38 static_assert( \ | 42 static_assert( \ |
| 39 static_cast<int32_t>(views::Widget::InitParams::TYPE_##NAME) == \ | 43 static_cast<int32_t>(views::Widget::InitParams::TYPE_##NAME) == \ |
| 40 static_cast<int32_t>(ui::mojom::WindowType::NAME), \ | 44 static_cast<int32_t>(ui::mojom::WindowType::NAME), \ |
| 41 "Window type constants must match") | 45 "Window type constants must match") |
| 42 | 46 |
| 43 WINDOW_TYPES_MATCH(WINDOW); | 47 WINDOW_TYPES_MATCH(WINDOW); |
| 44 WINDOW_TYPES_MATCH(PANEL); | 48 WINDOW_TYPES_MATCH(PANEL); |
| 45 WINDOW_TYPES_MATCH(WINDOW_FRAMELESS); | 49 WINDOW_TYPES_MATCH(WINDOW_FRAMELESS); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 60 MusClient::MusClient(service_manager::Connector* connector, | 64 MusClient::MusClient(service_manager::Connector* connector, |
| 61 const service_manager::Identity& identity, | 65 const service_manager::Identity& identity, |
| 62 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, | 66 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, |
| 63 bool create_wm_state, | 67 bool create_wm_state, |
| 64 MusClientTestingState testing_state) | 68 MusClientTestingState testing_state) |
| 65 : identity_(identity) { | 69 : identity_(identity) { |
| 66 DCHECK(!instance_); | 70 DCHECK(!instance_); |
| 67 DCHECK(aura::Env::GetInstance()); | 71 DCHECK(aura::Env::GetInstance()); |
| 68 instance_ = this; | 72 instance_ = this; |
| 69 | 73 |
| 74 #if defined(USE_OZONE) |
| 75 // If we're in a mus client, we aren't going to have all of ozone initialized |
| 76 // even though we're in an ozone build. All the hard coded USE_OZONE ifdefs |
| 77 // that handle cursor code expect that there will be a CursorFactoryOzone |
| 78 // instance. Partially initialize the ozone cursor internals here, like we |
| 79 // partially initialize other ozone subsystems in |
| 80 // ChromeBrowserMainExtraPartsViews. |
| 81 cursor_factory_ozone_ = base::MakeUnique<ui::CursorDataFactoryOzone>(); |
| 82 #endif |
| 83 |
| 70 if (!io_task_runner) { | 84 if (!io_task_runner) { |
| 71 io_thread_ = base::MakeUnique<base::Thread>("IOThread"); | 85 io_thread_ = base::MakeUnique<base::Thread>("IOThread"); |
| 72 base::Thread::Options thread_options(base::MessageLoop::TYPE_IO, 0); | 86 base::Thread::Options thread_options(base::MessageLoop::TYPE_IO, 0); |
| 73 thread_options.priority = base::ThreadPriority::NORMAL; | 87 thread_options.priority = base::ThreadPriority::NORMAL; |
| 74 CHECK(io_thread_->StartWithOptions(thread_options)); | 88 CHECK(io_thread_->StartWithOptions(thread_options)); |
| 75 io_task_runner = io_thread_->task_runner(); | 89 io_task_runner = io_thread_->task_runner(); |
| 76 } | 90 } |
| 77 | 91 |
| 78 // TODO(msw): Avoid this... use some default value? Allow clients to extend? | 92 // TODO(msw): Avoid this... use some default value? Allow clients to extend? |
| 79 property_converter_ = base::MakeUnique<aura::PropertyConverter>(); | 93 property_converter_ = base::MakeUnique<aura::PropertyConverter>(); |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 // TODO: this likely gets z-order wrong. http://crbug.com/663606. | 312 // TODO: this likely gets z-order wrong. http://crbug.com/663606. |
| 299 gfx::Point relative_point(point); | 313 gfx::Point relative_point(point); |
| 300 window_tree_host->ConvertScreenInPixelsToDIP(&relative_point); | 314 window_tree_host->ConvertScreenInPixelsToDIP(&relative_point); |
| 301 if (gfx::Rect(root->bounds().size()).Contains(relative_point)) | 315 if (gfx::Rect(root->bounds().size()).Contains(relative_point)) |
| 302 return root->GetEventHandlerForPoint(relative_point); | 316 return root->GetEventHandlerForPoint(relative_point); |
| 303 } | 317 } |
| 304 return nullptr; | 318 return nullptr; |
| 305 } | 319 } |
| 306 | 320 |
| 307 } // namespace views | 321 } // namespace views |
| OLD | NEW |