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

Side by Side Diff: services/ui/ws/window_tree_host_factory.cc

Issue 2712203002: c++ / mojo changes for 'external window mode'
Patch Set: rebased 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/ws/window_tree_host_factory.h" 5 #include "services/ui/ws/window_tree_host_factory.h"
6 6
7 #include "services/ui/display/viewport_metrics.h" 7 #include "services/ui/display/viewport_metrics.h"
8 #include "services/ui/ws/display.h" 8 #include "services/ui/ws/display.h"
9 #include "services/ui/ws/display_binding.h" 9 #include "services/ui/ws/display_binding.h"
10 #include "services/ui/ws/window_server.h" 10 #include "services/ui/ws/window_server.h"
11 #include "services/ui/ws/window_tree.h"
11 12
12 namespace ui { 13 namespace ui {
13 namespace ws { 14 namespace ws {
14 15
15 WindowTreeHostFactory::WindowTreeHostFactory(WindowServer* window_server, 16 WindowTreeHostFactory::WindowTreeHostFactory(WindowServer* window_server,
16 const UserId& user_id) 17 const UserId& user_id)
17 : window_server_(window_server), user_id_(user_id) {} 18 : window_server_(window_server), user_id_(user_id) {}
18 19
19 WindowTreeHostFactory::~WindowTreeHostFactory() {} 20 WindowTreeHostFactory::~WindowTreeHostFactory() {}
20 21
(...skipping 16 matching lines...) Expand all
37 metrics.bounds_in_pixels = gfx::Rect(1024, 768); 38 metrics.bounds_in_pixels = gfx::Rect(1024, 768);
38 metrics.device_scale_factor = 1.0f; 39 metrics.device_scale_factor = 1.0f;
39 metrics.ui_scale_factor = 1.0f; 40 metrics.ui_scale_factor = 1.0f;
40 41
41 display::Display display(1, metrics.bounds_in_pixels); 42 display::Display display(1, metrics.bounds_in_pixels);
42 ws_display->SetDisplay(display); 43 ws_display->SetDisplay(display);
43 44
44 ws_display->Init(metrics, std::move(display_binding)); 45 ws_display->Init(metrics, std::move(display_binding));
45 } 46 }
46 47
48 void WindowTreeHostFactory::CreatePlatformWindow(
49 mojom::WindowTreeHostRequest tree_host_request,
50 Id transport_window_id) {
51 WindowTree* tree = window_server_->GetTreeForExternalWindowMode();
52 tree->WillCreateRootDisplay(transport_window_id);
53
54 Display* ws_display = new Display(window_server_);
55
56 std::unique_ptr<DisplayBindingImpl> display_binding(
57 new DisplayBindingImpl(std::move(tree_host_request), ws_display, user_id_,
58 nullptr, window_server_));
59
60 // Provide an initial size for the WindowTreeHost.
61 display::ViewportMetrics metrics;
62 metrics.bounds_in_pixels = gfx::Rect(1024, 768);
63 metrics.device_scale_factor = 1.0f;
64 metrics.ui_scale_factor = 1.0f;
65
66 ws_display->Init(metrics, std::move(display_binding));
67 }
68
47 } // namespace ws 69 } // namespace ws
48 } // namespace ui 70 } // namespace ui
OLDNEW
« no previous file with comments | « services/ui/ws/window_tree_host_factory.h ('k') | services/ui/ws/window_tree_host_factory_registrar.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698