Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(257)

Side by Side Diff: ash/host/ash_window_tree_host_unified.cc

Issue 1867223004: Convert //ash from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ash/host/ash_window_tree_host_platform.cc ('k') | ash/host/ash_window_tree_host_x11.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "ui/aura/window.h" 13 #include "ui/aura/window.h"
13 #include "ui/aura/window_event_dispatcher.h" 14 #include "ui/aura/window_event_dispatcher.h"
14 #include "ui/aura/window_targeter.h" 15 #include "ui/aura/window_targeter.h"
15 #include "ui/compositor/compositor.h" 16 #include "ui/compositor/compositor.h"
16 #include "ui/gfx/geometry/insets.h" 17 #include "ui/gfx/geometry/insets.h"
17 #include "ui/platform_window/stub/stub_window.h" 18 #include "ui/platform_window/stub/stub_window.h"
18 19
19 namespace ash { 20 namespace ash {
20 21
21 class UnifiedEventTargeter : public aura::WindowTargeter { 22 class UnifiedEventTargeter : public aura::WindowTargeter {
(...skipping 20 matching lines...) Expand all
42 43
43 aura::Window* src_root_; 44 aura::Window* src_root_;
44 aura::Window* dst_root_; 45 aura::Window* dst_root_;
45 46
46 DISALLOW_COPY_AND_ASSIGN(UnifiedEventTargeter); 47 DISALLOW_COPY_AND_ASSIGN(UnifiedEventTargeter);
47 }; 48 };
48 49
49 AshWindowTreeHostUnified::AshWindowTreeHostUnified( 50 AshWindowTreeHostUnified::AshWindowTreeHostUnified(
50 const gfx::Rect& initial_bounds) 51 const gfx::Rect& initial_bounds)
51 : AshWindowTreeHostPlatform() { 52 : AshWindowTreeHostPlatform() {
52 scoped_ptr<ui::PlatformWindow> window(new ui::StubWindow(this)); 53 std::unique_ptr<ui::PlatformWindow> window(new ui::StubWindow(this));
53 window->SetBounds(initial_bounds); 54 window->SetBounds(initial_bounds);
54 SetPlatformWindow(std::move(window)); 55 SetPlatformWindow(std::move(window));
55 } 56 }
56 57
57 AshWindowTreeHostUnified::~AshWindowTreeHostUnified() { 58 AshWindowTreeHostUnified::~AshWindowTreeHostUnified() {
58 for (auto* ash_host : mirroring_hosts_) 59 for (auto* ash_host : mirroring_hosts_)
59 ash_host->AsWindowTreeHost()->window()->RemoveObserver(this); 60 ash_host->AsWindowTreeHost()->window()->RemoveObserver(this);
60 } 61 }
61 62
62 void AshWindowTreeHostUnified::PrepareForShutdown() { 63 void AshWindowTreeHostUnified::PrepareForShutdown() {
63 AshWindowTreeHostPlatform::PrepareForShutdown(); 64 AshWindowTreeHostPlatform::PrepareForShutdown();
64 65
65 for (auto host : mirroring_hosts_) 66 for (auto host : mirroring_hosts_)
66 host->PrepareForShutdown(); 67 host->PrepareForShutdown();
67 } 68 }
68 69
69 void AshWindowTreeHostUnified::RegisterMirroringHost( 70 void AshWindowTreeHostUnified::RegisterMirroringHost(
70 AshWindowTreeHost* mirroring_ash_host) { 71 AshWindowTreeHost* mirroring_ash_host) {
71 aura::Window* src_root = mirroring_ash_host->AsWindowTreeHost()->window(); 72 aura::Window* src_root = mirroring_ash_host->AsWindowTreeHost()->window();
72 src_root->SetEventTargeter( 73 src_root->SetEventTargeter(
73 make_scoped_ptr(new UnifiedEventTargeter(src_root, window()))); 74 base::WrapUnique(new UnifiedEventTargeter(src_root, window())));
74 DCHECK(std::find(mirroring_hosts_.begin(), mirroring_hosts_.end(), 75 DCHECK(std::find(mirroring_hosts_.begin(), mirroring_hosts_.end(),
75 mirroring_ash_host) == mirroring_hosts_.end()); 76 mirroring_ash_host) == mirroring_hosts_.end());
76 mirroring_hosts_.push_back(mirroring_ash_host); 77 mirroring_hosts_.push_back(mirroring_ash_host);
77 mirroring_ash_host->AsWindowTreeHost()->window()->AddObserver(this); 78 mirroring_ash_host->AsWindowTreeHost()->window()->AddObserver(this);
78 } 79 }
79 80
80 void AshWindowTreeHostUnified::SetBounds(const gfx::Rect& bounds) { 81 void AshWindowTreeHostUnified::SetBounds(const gfx::Rect& bounds) {
81 AshWindowTreeHostPlatform::SetBounds(bounds); 82 AshWindowTreeHostPlatform::SetBounds(bounds);
82 OnHostResized(bounds.size()); 83 OnHostResized(bounds.size());
83 } 84 }
(...skipping 18 matching lines...) Expand all
102 std::find_if(mirroring_hosts_.begin(), mirroring_hosts_.end(), 103 std::find_if(mirroring_hosts_.begin(), mirroring_hosts_.end(),
103 [window](AshWindowTreeHost* ash_host) { 104 [window](AshWindowTreeHost* ash_host) {
104 return ash_host->AsWindowTreeHost()->window() == window; 105 return ash_host->AsWindowTreeHost()->window() == window;
105 }); 106 });
106 DCHECK(iter != mirroring_hosts_.end()); 107 DCHECK(iter != mirroring_hosts_.end());
107 window->RemoveObserver(this); 108 window->RemoveObserver(this);
108 mirroring_hosts_.erase(iter); 109 mirroring_hosts_.erase(iter);
109 } 110 }
110 111
111 } // namespace ash 112 } // namespace ash
OLDNEW
« no previous file with comments | « ash/host/ash_window_tree_host_platform.cc ('k') | ash/host/ash_window_tree_host_x11.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698