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

Side by Side Diff: services/ui/demo/mus_demo_internal.cc

Issue 2755673003: Allow parallel creation of windows
Patch Set: nits Created 3 years, 9 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 | « services/ui/demo/mus_demo_external.cc ('k') | services/ui/demo/window_tree_data.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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 "services/ui/demo/mus_demo_internal.h" 5 #include "services/ui/demo/mus_demo_internal.h"
6 6
7 #include "services/service_manager/public/cpp/service_context.h" 7 #include "services/service_manager/public/cpp/service_context.h"
8 #include "services/ui/demo/window_tree_data.h" 8 #include "services/ui/demo/window_tree_data.h"
9 #include "ui/aura/mus/window_tree_client.h" 9 #include "ui/aura/mus/window_tree_client.h"
10 #include "ui/aura/mus/window_tree_host_mus.h" 10 #include "ui/aura/mus/window_tree_host_mus.h"
11 11
12 namespace ui { 12 namespace ui {
13 namespace demo { 13 namespace demo {
14 14
15 namespace { 15 namespace {
16 16
17 class WindowTreeDataInternal : public WindowTreeData {
18 public:
19 // Creates a new window tree host associated to the WindowTreeData.
20 WindowTreeDataInternal(
21 std::unique_ptr<aura::WindowTreeHostMus> window_tree_host,
22 int square_size)
23 : WindowTreeData(square_size) {
24 DCHECK(window_tree_host);
25 window_tree_host->InitHost();
26 window_tree_host->Show();
27 SetWindowTreeHost(std::move(window_tree_host));
28 }
29
30 DISALLOW_COPY_AND_ASSIGN(WindowTreeDataInternal);
31 };
32
17 // Size of square in pixels to draw. 33 // Size of square in pixels to draw.
18 const int kSquareSize = 300; 34 const int kSquareSize = 300;
19 } 35 }
20 36
21 MusDemoInternal::MusDemoInternal() {} 37 MusDemoInternal::MusDemoInternal() {}
22 38
23 MusDemoInternal::~MusDemoInternal() {} 39 MusDemoInternal::~MusDemoInternal() {}
24 40
25 std::unique_ptr<aura::WindowTreeClient> 41 std::unique_ptr<aura::WindowTreeClient>
26 MusDemoInternal::CreateWindowTreeClient() { 42 MusDemoInternal::CreateWindowTreeClient() {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 // Don't care 79 // Don't care
64 } 80 }
65 81
66 void MusDemoInternal::OnWmWillCreateDisplay(const display::Display& display) { 82 void MusDemoInternal::OnWmWillCreateDisplay(const display::Display& display) {
67 AddPrimaryDisplay(display); 83 AddPrimaryDisplay(display);
68 } 84 }
69 85
70 void MusDemoInternal::OnWmNewDisplay( 86 void MusDemoInternal::OnWmNewDisplay(
71 std::unique_ptr<aura::WindowTreeHostMus> window_tree_host, 87 std::unique_ptr<aura::WindowTreeHostMus> window_tree_host,
72 const display::Display& display) { 88 const display::Display& display) {
73 AppendWindowTreeData(base::MakeUnique<WindowTreeData>(kSquareSize)); 89 std::unique_ptr<WindowTreeDataInternal> window_tree_data =
74 InitWindowTreeData(std::move(window_tree_host)); 90 base::MakeUnique<WindowTreeDataInternal>(std::move(window_tree_host),
91 kSquareSize);
92 window_tree_data->Init();
93 AppendWindowTreeData(std::move(window_tree_data));
75 } 94 }
76 95
77 void MusDemoInternal::OnWmDisplayRemoved( 96 void MusDemoInternal::OnWmDisplayRemoved(
78 aura::WindowTreeHostMus* window_tree_host) { 97 aura::WindowTreeHostMus* window_tree_host) {
79 RemoveWindowTreeData(window_tree_host); 98 RemoveWindowTreeData(window_tree_host);
80 } 99 }
81 100
82 void MusDemoInternal::OnWmDisplayModified(const display::Display& display) {} 101 void MusDemoInternal::OnWmDisplayModified(const display::Display& display) {}
83 102
84 mojom::EventResult MusDemoInternal::OnAccelerator(uint32_t id, 103 mojom::EventResult MusDemoInternal::OnAccelerator(uint32_t id,
(...skipping 17 matching lines...) Expand all
102 const std::vector<gfx::Rect>& additional_client_areas) {} 121 const std::vector<gfx::Rect>& additional_client_areas) {}
103 122
104 bool MusDemoInternal::IsWindowActive(aura::Window* window) { 123 bool MusDemoInternal::IsWindowActive(aura::Window* window) {
105 return false; 124 return false;
106 } 125 }
107 126
108 void MusDemoInternal::OnWmDeactivateWindow(aura::Window* window) {} 127 void MusDemoInternal::OnWmDeactivateWindow(aura::Window* window) {}
109 128
110 } // namespace demo 129 } // namespace demo
111 } // namespace ui 130 } // namespace ui
OLDNEW
« no previous file with comments | « services/ui/demo/mus_demo_external.cc ('k') | services/ui/demo/window_tree_data.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698