| 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 if (details.dispatcher_destroyed) |
| 113 return true; |
| 110 input_method_handler()->SetPostIME(false); | 114 input_method_handler()->SetPostIME(false); |
| 111 return event_copy.stopped_propagation(); | 115 return event_copy.stopped_propagation(); |
| 112 } | 116 } |
| 113 | 117 |
| 114 // ui::EventSource: | |
| 115 ui::EventDispatchDetails DeliverEventToProcessor(ui::Event* event) override { | |
| 116 return ui::EventSource::DeliverEventToProcessor(event); | |
| 117 } | |
| 118 | |
| 119 bool fullscreen_; | 118 bool fullscreen_; |
| 120 RECT saved_window_rect_; | 119 RECT saved_window_rect_; |
| 121 DWORD saved_window_style_; | 120 DWORD saved_window_style_; |
| 122 DWORD saved_window_ex_style_; | 121 DWORD saved_window_ex_style_; |
| 123 | 122 |
| 124 TransformerHelper transformer_helper_; | 123 TransformerHelper transformer_helper_; |
| 125 | 124 |
| 126 DISALLOW_COPY_AND_ASSIGN(AshWindowTreeHostWin); | 125 DISALLOW_COPY_AND_ASSIGN(AshWindowTreeHostWin); |
| 127 }; | 126 }; |
| 128 | 127 |
| 129 } // namespace | 128 } // namespace |
| 130 | 129 |
| 131 AshWindowTreeHost* AshWindowTreeHost::Create( | 130 AshWindowTreeHost* AshWindowTreeHost::Create( |
| 132 const AshWindowTreeHostInitParams& init_params) { | 131 const AshWindowTreeHostInitParams& init_params) { |
| 133 if (base::win::GetVersion() >= base::win::VERSION_WIN7 && | 132 if (base::win::GetVersion() >= base::win::VERSION_WIN7 && |
| 134 !base::CommandLine::ForCurrentProcess()->HasSwitch( | 133 !base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 135 ash::switches::kForceAshToDesktop)) | 134 ash::switches::kForceAshToDesktop)) |
| 136 return new AshRemoteWindowTreeHostWin(init_params.remote_hwnd); | 135 return new AshRemoteWindowTreeHostWin(init_params.remote_hwnd); |
| 137 | 136 |
| 138 return new AshWindowTreeHostWin(init_params.initial_bounds); | 137 return new AshWindowTreeHostWin(init_params.initial_bounds); |
| 139 } | 138 } |
| 140 | 139 |
| 141 } // namespace ash | 140 } // namespace ash |
| OLD | NEW |