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/callback.h" | 7 #include "base/callback.h" |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
11 #include "base/threading/thread_task_runner_handle.h" | 11 #include "base/threading/thread_task_runner_handle.h" |
12 #include "components/bitmap_uploader/bitmap_uploader.h" | |
13 #include "services/ui/common/gpu_service.h" | 12 #include "services/ui/common/gpu_service.h" |
| 13 #include "services/ui/public/cpp/bitmap_uploader.h" |
14 #include "services/ui/public/cpp/property_type_converters.h" | 14 #include "services/ui/public/cpp/property_type_converters.h" |
15 #include "services/ui/public/cpp/window.h" | 15 #include "services/ui/public/cpp/window.h" |
16 #include "services/ui/public/cpp/window_observer.h" | 16 #include "services/ui/public/cpp/window_observer.h" |
17 #include "services/ui/public/cpp/window_property.h" | 17 #include "services/ui/public/cpp/window_property.h" |
18 #include "services/ui/public/cpp/window_tree_client.h" | 18 #include "services/ui/public/cpp/window_tree_client.h" |
19 #include "services/ui/public/interfaces/cursor.mojom.h" | 19 #include "services/ui/public/interfaces/cursor.mojom.h" |
20 #include "services/ui/public/interfaces/window_manager.mojom.h" | 20 #include "services/ui/public/interfaces/window_manager.mojom.h" |
21 #include "services/ui/public/interfaces/window_manager_constants.mojom.h" | 21 #include "services/ui/public/interfaces/window_manager_constants.mojom.h" |
22 #include "services/ui/public/interfaces/window_tree.mojom.h" | 22 #include "services/ui/public/interfaces/window_tree.mojom.h" |
23 #include "ui/aura/client/default_capture_client.h" | 23 #include "ui/aura/client/default_capture_client.h" |
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
538 context_factory_.reset( | 538 context_factory_.reset( |
539 new SurfaceContextFactory(connector, window_, surface_type_)); | 539 new SurfaceContextFactory(connector, window_, surface_type_)); |
540 aura::Env::GetInstance()->set_context_factory(context_factory_.get()); | 540 aura::Env::GetInstance()->set_context_factory(context_factory_.get()); |
541 } else if (!ui::GpuService::UseChromeGpuCommandBuffer()) { | 541 } else if (!ui::GpuService::UseChromeGpuCommandBuffer()) { |
542 // Only use the BitmapUploader when the mojo command buffer is being used. | 542 // Only use the BitmapUploader when the mojo command buffer is being used. |
543 needs_bitmap_uploader = true; | 543 needs_bitmap_uploader = true; |
544 } | 544 } |
545 | 545 |
546 window_tree_host_.reset(new WindowTreeHostMus(this, window_)); | 546 window_tree_host_.reset(new WindowTreeHostMus(this, window_)); |
547 if (needs_bitmap_uploader) { | 547 if (needs_bitmap_uploader) { |
548 bitmap_uploader_.reset(new bitmap_uploader::BitmapUploader(window)); | 548 bitmap_uploader_.reset(new ui::BitmapUploader(window)); |
549 bitmap_uploader_->Init(connector); | 549 bitmap_uploader_->Init(connector); |
550 prop_ = base::MakeUnique<ui::ViewProp>( | 550 prop_ = base::MakeUnique<ui::ViewProp>( |
551 window_tree_host_->GetAcceleratedWidget(), | 551 window_tree_host_->GetAcceleratedWidget(), |
552 bitmap_uploader::kBitmapUploaderForAcceleratedWidget, | 552 ui::kBitmapUploaderForAcceleratedWidget, |
553 bitmap_uploader_.get()); | 553 bitmap_uploader_.get()); |
554 } | 554 } |
555 | 555 |
556 aura::Env::GetInstance()->set_context_factory(default_context_factory); | 556 aura::Env::GetInstance()->set_context_factory(default_context_factory); |
557 } | 557 } |
558 | 558 |
559 NativeWidgetMus::~NativeWidgetMus() { | 559 NativeWidgetMus::~NativeWidgetMus() { |
560 if (ownership_ == Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET) { | 560 if (ownership_ == Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET) { |
561 DCHECK(!window_); | 561 DCHECK(!window_); |
562 delete native_widget_delegate_; | 562 delete native_widget_delegate_; |
(...skipping 875 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1438 | 1438 |
1439 gfx::Path mask_path; | 1439 gfx::Path mask_path; |
1440 native_widget_delegate_->GetHitTestMask(&mask_path); | 1440 native_widget_delegate_->GetHitTestMask(&mask_path); |
1441 // TODO(jamescook): Use the full path for the mask. | 1441 // TODO(jamescook): Use the full path for the mask. |
1442 gfx::Rect mask_rect = | 1442 gfx::Rect mask_rect = |
1443 gfx::ToEnclosingRect(gfx::SkRectToRectF(mask_path.getBounds())); | 1443 gfx::ToEnclosingRect(gfx::SkRectToRectF(mask_path.getBounds())); |
1444 window_->SetHitTestMask(mask_rect); | 1444 window_->SetHitTestMask(mask_rect); |
1445 } | 1445 } |
1446 | 1446 |
1447 } // namespace views | 1447 } // namespace views |
OLD | NEW |