| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ash/host/ash_window_tree_host.h" | 5 #include "ash/host/ash_window_tree_host.h" |
| 6 | 6 |
| 7 #include "ash/ash_export.h" | 7 #include "ash/ash_export.h" |
| 8 #include "ash/ash_switches.h" | 8 #include "ash/ash_switches.h" |
| 9 #include "ash/host/ash_remote_window_tree_host_win.h" | 9 #include "ash/host/ash_remote_window_tree_host_win.h" |
| 10 #include "ash/host/ash_window_tree_host_init_params.h" | 10 #include "ash/host/ash_window_tree_host_init_params.h" |
| 11 #include "ash/host/root_window_transformer.h" | 11 #include "ash/host/root_window_transformer.h" |
| 12 #include "ash/host/transformer_helper.h" | 12 #include "ash/host/transformer_helper.h" |
| 13 #include "ash/ime/input_method_event_handler.h" | 13 #include "ash/ime/input_method_event_handler.h" |
| 14 #include "base/command_line.h" | 14 #include "base/command_line.h" |
| 15 #include "base/win/windows_version.h" | 15 #include "base/win/windows_version.h" |
| 16 #include "ui/aura/window_tree_host_win.h" | 16 #include "ui/aura/window_tree_host_win.h" |
| 17 #include "ui/events/event_processor.h" |
| 17 #include "ui/gfx/geometry/insets.h" | 18 #include "ui/gfx/geometry/insets.h" |
| 18 #include "ui/gfx/transform.h" | 19 #include "ui/gfx/transform.h" |
| 19 | 20 |
| 20 namespace ash { | 21 namespace ash { |
| 21 namespace { | 22 namespace { |
| 22 | 23 |
| 23 class AshWindowTreeHostWin : public AshWindowTreeHost, | 24 class AshWindowTreeHostWin : public AshWindowTreeHost, |
| 24 public aura::WindowTreeHostWin { | 25 public aura::WindowTreeHostWin { |
| 25 public: | 26 public: |
| 26 explicit AshWindowTreeHostWin(const gfx::Rect& initial_bounds) | 27 explicit AshWindowTreeHostWin(const gfx::Rect& initial_bounds) |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 return transformer_helper_.GetInverseTransform(); | 100 return transformer_helper_.GetInverseTransform(); |
| 100 } | 101 } |
| 101 void UpdateRootWindowSize(const gfx::Size& host_size) override { | 102 void UpdateRootWindowSize(const gfx::Size& host_size) override { |
| 102 transformer_helper_.UpdateWindowSize(host_size); | 103 transformer_helper_.UpdateWindowSize(host_size); |
| 103 } | 104 } |
| 104 | 105 |
| 105 // ui::internal::InputMethodDelegate: | 106 // ui::internal::InputMethodDelegate: |
| 106 bool DispatchKeyEventPostIME(const ui::KeyEvent& event) override { | 107 bool DispatchKeyEventPostIME(const ui::KeyEvent& event) override { |
| 107 ui::KeyEvent event_copy(event); | 108 ui::KeyEvent event_copy(event); |
| 108 input_method_handler()->SetPostIME(true); | 109 input_method_handler()->SetPostIME(true); |
| 109 ui::EventSource::DeliverEventToProcessor(&event_copy); | 110 ui::EventDispatchDetails details = |
| 111 event_processor()->OnEventFromSource(&event_copy); |
| 112 DCHECK(!details.dispatcher_destroyed); |
| 110 input_method_handler()->SetPostIME(false); | 113 input_method_handler()->SetPostIME(false); |
| 111 return event_copy.stopped_propagation(); | 114 return event_copy.stopped_propagation(); |
| 112 } | 115 } |
| 113 | 116 |
| 114 // ui::EventSource: | |
| 115 ui::EventDispatchDetails DeliverEventToProcessor(ui::Event* event) override { | |
| 116 return ui::EventSource::DeliverEventToProcessor(event); | |
| 117 } | |
| 118 | |
| 119 bool fullscreen_; | 117 bool fullscreen_; |
| 120 RECT saved_window_rect_; | 118 RECT saved_window_rect_; |
| 121 DWORD saved_window_style_; | 119 DWORD saved_window_style_; |
| 122 DWORD saved_window_ex_style_; | 120 DWORD saved_window_ex_style_; |
| 123 | 121 |
| 124 TransformerHelper transformer_helper_; | 122 TransformerHelper transformer_helper_; |
| 125 | 123 |
| 126 DISALLOW_COPY_AND_ASSIGN(AshWindowTreeHostWin); | 124 DISALLOW_COPY_AND_ASSIGN(AshWindowTreeHostWin); |
| 127 }; | 125 }; |
| 128 | 126 |
| 129 } // namespace | 127 } // namespace |
| 130 | 128 |
| 131 AshWindowTreeHost* AshWindowTreeHost::Create( | 129 AshWindowTreeHost* AshWindowTreeHost::Create( |
| 132 const AshWindowTreeHostInitParams& init_params) { | 130 const AshWindowTreeHostInitParams& init_params) { |
| 133 if (base::win::GetVersion() >= base::win::VERSION_WIN7 && | 131 if (base::win::GetVersion() >= base::win::VERSION_WIN7 && |
| 134 !base::CommandLine::ForCurrentProcess()->HasSwitch( | 132 !base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 135 ash::switches::kForceAshToDesktop)) | 133 ash::switches::kForceAshToDesktop)) |
| 136 return new AshRemoteWindowTreeHostWin(init_params.remote_hwnd); | 134 return new AshRemoteWindowTreeHostWin(init_params.remote_hwnd); |
| 137 | 135 |
| 138 return new AshWindowTreeHostWin(init_params.initial_bounds); | 136 return new AshWindowTreeHostWin(init_params.initial_bounds); |
| 139 } | 137 } |
| 140 | 138 |
| 141 } // namespace ash | 139 } // namespace ash |
| OLD | NEW |