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