Chromium Code Reviews| 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 "ash/host/ash_window_tree_host_unified.h" | 5 #include "ash/host/ash_window_tree_host_unified.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "ash/host/root_window_transformer.h" | 9 #include "ash/host/root_window_transformer.h" |
| 10 #include "ash/ime/input_method_event_handler.h" | 10 #include "ash/ime/input_method_event_handler.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/memory/ptr_util.h" | 12 #include "base/memory/ptr_util.h" |
| 13 #include "ui/aura/window.h" | 13 #include "ui/aura/window.h" |
| 14 #include "ui/aura/window_event_dispatcher.h" | 14 #include "ui/aura/window_event_dispatcher.h" |
| 15 #include "ui/aura/window_targeter.h" | 15 #include "ui/aura/window_targeter.h" |
| 16 #include "ui/compositor/compositor.h" | 16 #include "ui/compositor/compositor.h" |
| 17 #include "ui/gfx/geometry/dip_util.h" | |
| 17 #include "ui/gfx/geometry/insets.h" | 18 #include "ui/gfx/geometry/insets.h" |
| 18 #include "ui/platform_window/stub/stub_window.h" | 19 #include "ui/platform_window/stub/stub_window.h" |
| 19 | 20 |
| 20 namespace ash { | 21 namespace ash { |
| 21 | 22 |
| 22 class UnifiedEventTargeter : public aura::WindowTargeter { | 23 class UnifiedEventTargeter : public aura::WindowTargeter { |
| 23 public: | 24 public: |
| 24 UnifiedEventTargeter(aura::Window* src_root, aura::Window* dst_root) | 25 UnifiedEventTargeter(aura::Window* src_root, aura::Window* dst_root) |
| 25 : src_root_(src_root), dst_root_(dst_root) {} | 26 : src_root_(src_root), dst_root_(dst_root) {} |
| 26 | 27 |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 44 aura::Window* src_root_; | 45 aura::Window* src_root_; |
| 45 aura::Window* dst_root_; | 46 aura::Window* dst_root_; |
| 46 | 47 |
| 47 DISALLOW_COPY_AND_ASSIGN(UnifiedEventTargeter); | 48 DISALLOW_COPY_AND_ASSIGN(UnifiedEventTargeter); |
| 48 }; | 49 }; |
| 49 | 50 |
| 50 AshWindowTreeHostUnified::AshWindowTreeHostUnified( | 51 AshWindowTreeHostUnified::AshWindowTreeHostUnified( |
| 51 const gfx::Rect& initial_bounds) | 52 const gfx::Rect& initial_bounds) |
| 52 : AshWindowTreeHostPlatform() { | 53 : AshWindowTreeHostPlatform() { |
| 53 std::unique_ptr<ui::PlatformWindow> window(new ui::StubWindow(this)); | 54 std::unique_ptr<ui::PlatformWindow> window(new ui::StubWindow(this)); |
| 54 window->SetBounds(initial_bounds); | 55 window->SetBounds(gfx::ConvertRectToPixel(compositor()->device_scale_factor(), |
|
sadrul
2016/11/17 20:26:21
It may make sense to rename PlatformWindow::SetBou
riajiang
2016/11/17 21:43:28
Added to that bug.
| |
| 56 initial_bounds)); | |
| 55 SetPlatformWindow(std::move(window)); | 57 SetPlatformWindow(std::move(window)); |
| 56 } | 58 } |
| 57 | 59 |
| 58 AshWindowTreeHostUnified::~AshWindowTreeHostUnified() { | 60 AshWindowTreeHostUnified::~AshWindowTreeHostUnified() { |
| 59 for (auto* ash_host : mirroring_hosts_) | 61 for (auto* ash_host : mirroring_hosts_) |
| 60 ash_host->AsWindowTreeHost()->window()->RemoveObserver(this); | 62 ash_host->AsWindowTreeHost()->window()->RemoveObserver(this); |
| 61 } | 63 } |
| 62 | 64 |
| 63 void AshWindowTreeHostUnified::PrepareForShutdown() { | 65 void AshWindowTreeHostUnified::PrepareForShutdown() { |
| 64 AshWindowTreeHostPlatform::PrepareForShutdown(); | 66 AshWindowTreeHostPlatform::PrepareForShutdown(); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 103 std::find_if(mirroring_hosts_.begin(), mirroring_hosts_.end(), | 105 std::find_if(mirroring_hosts_.begin(), mirroring_hosts_.end(), |
| 104 [window](AshWindowTreeHost* ash_host) { | 106 [window](AshWindowTreeHost* ash_host) { |
| 105 return ash_host->AsWindowTreeHost()->window() == window; | 107 return ash_host->AsWindowTreeHost()->window() == window; |
| 106 }); | 108 }); |
| 107 DCHECK(iter != mirroring_hosts_.end()); | 109 DCHECK(iter != mirroring_hosts_.end()); |
| 108 window->RemoveObserver(this); | 110 window->RemoveObserver(this); |
| 109 mirroring_hosts_.erase(iter); | 111 mirroring_hosts_.erase(iter); |
| 110 } | 112 } |
| 111 | 113 |
| 112 } // namespace ash | 114 } // namespace ash |
| OLD | NEW |