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_tree_host_mus.h" | 5 #include "ui/views/mus/window_tree_host_mus.h" |
6 | 6 |
7 #include "components/bitmap_uploader/bitmap_uploader.h" | |
8 #include "mojo/shell/public/interfaces/shell.mojom.h" | |
9 #include "ui/aura/window.h" | 7 #include "ui/aura/window.h" |
10 #include "ui/aura/window_event_dispatcher.h" | 8 #include "ui/aura/window_event_dispatcher.h" |
11 #include "ui/base/view_prop.h" | |
12 #include "ui/events/event.h" | 9 #include "ui/events/event.h" |
13 #include "ui/views/mus/input_method_mus.h" | 10 #include "ui/views/mus/input_method_mus.h" |
14 #include "ui/views/mus/native_widget_mus.h" | 11 #include "ui/views/mus/native_widget_mus.h" |
15 #include "ui/views/mus/platform_window_mus.h" | 12 #include "ui/views/mus/platform_window_mus.h" |
16 | 13 |
17 namespace views { | 14 namespace views { |
18 | 15 |
19 //////////////////////////////////////////////////////////////////////////////// | 16 //////////////////////////////////////////////////////////////////////////////// |
20 // WindowTreeHostMus, public: | 17 // WindowTreeHostMus, public: |
21 | 18 |
22 WindowTreeHostMus::WindowTreeHostMus(mojo::Shell* shell, | 19 WindowTreeHostMus::WindowTreeHostMus(mojo::Shell* shell, |
23 NativeWidgetMus* native_widget, | 20 NativeWidgetMus* native_widget, |
24 mus::Window* window, | 21 mus::Window* window, |
25 mus::mojom::SurfaceType surface_type) | 22 mus::mojom::SurfaceType surface_type) |
26 : native_widget_(native_widget), | 23 : native_widget_(native_widget), |
27 show_state_(ui::PLATFORM_WINDOW_STATE_UNKNOWN) { | 24 show_state_(ui::PLATFORM_WINDOW_STATE_UNKNOWN) { |
28 SetPlatformWindow(make_scoped_ptr(new PlatformWindowMus(this, window))); | 25 SetPlatformWindow( |
| 26 make_scoped_ptr(new PlatformWindowMus(this, shell, window))); |
29 // The location of events is already transformed, and there is no way to | 27 // The location of events is already transformed, and there is no way to |
30 // correctly determine the reverse transform. So, don't attempt to transform | 28 // correctly determine the reverse transform. So, don't attempt to transform |
31 // event locations, else the root location is wrong. | 29 // event locations, else the root location is wrong. |
32 // TODO(sky): we need to transform for device scale though. | 30 // TODO(sky): we need to transform for device scale though. |
33 dispatcher()->set_transform_events(false); | 31 dispatcher()->set_transform_events(false); |
34 compositor()->SetHostHasTransparentBackground(true); | 32 compositor()->SetHostHasTransparentBackground(true); |
35 | 33 |
36 bitmap_uploader_.reset(new bitmap_uploader::BitmapUploader(window)); | |
37 bitmap_uploader_->Init(shell); | |
38 prop_.reset( | |
39 new ui::ViewProp(GetAcceleratedWidget(), | |
40 bitmap_uploader::kBitmapUploaderForAcceleratedWidget, | |
41 bitmap_uploader_.get())); | |
42 | |
43 input_method_.reset(new InputMethodMUS(this, window)); | 34 input_method_.reset(new InputMethodMUS(this, window)); |
44 SetSharedInputMethod(input_method_.get()); | 35 SetSharedInputMethod(input_method_.get()); |
45 } | 36 } |
46 | 37 |
47 WindowTreeHostMus::~WindowTreeHostMus() { | 38 WindowTreeHostMus::~WindowTreeHostMus() { |
48 DestroyCompositor(); | 39 DestroyCompositor(); |
49 DestroyDispatcher(); | 40 DestroyDispatcher(); |
50 } | 41 } |
51 | 42 |
52 PlatformWindowMus* WindowTreeHostMus::platform_window() { | 43 PlatformWindowMus* WindowTreeHostMus::platform_window() { |
(...skipping 27 matching lines...) Expand all Loading... |
80 if (native_widget_) | 71 if (native_widget_) |
81 native_widget_->OnActivationChanged(active); | 72 native_widget_->OnActivationChanged(active); |
82 WindowTreeHostPlatform::OnActivationChanged(active); | 73 WindowTreeHostPlatform::OnActivationChanged(active); |
83 } | 74 } |
84 | 75 |
85 void WindowTreeHostMus::OnCloseRequest() { | 76 void WindowTreeHostMus::OnCloseRequest() { |
86 OnHostCloseRequested(); | 77 OnHostCloseRequested(); |
87 } | 78 } |
88 | 79 |
89 } // namespace views | 80 } // namespace views |
OLD | NEW |