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 "mojo/services/view_manager/root_view_manager.h" | 5 #include "mojo/services/view_manager/root_view_manager.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "mojo/aura/screen_mojo.h" | 8 #include "mojo/aura/screen_mojo.h" |
9 #include "mojo/aura/window_tree_host_mojo.h" | 9 #include "mojo/aura/window_tree_host_mojo.h" |
10 #include "mojo/public/cpp/application/connect.h" | 10 #include "mojo/public/cpp/shell/connect.h" |
11 #include "mojo/public/interfaces/service_provider/service_provider.mojom.h" | 11 #include "mojo/public/interfaces/shell/shell.mojom.h" |
12 #include "mojo/services/view_manager/root_node_manager.h" | 12 #include "mojo/services/view_manager/root_node_manager.h" |
13 #include "ui/aura/client/default_capture_client.h" | 13 #include "ui/aura/client/default_capture_client.h" |
14 #include "ui/aura/client/window_tree_client.h" | 14 #include "ui/aura/client/window_tree_client.h" |
15 #include "ui/aura/window.h" | 15 #include "ui/aura/window.h" |
16 | 16 |
17 namespace mojo { | 17 namespace mojo { |
18 namespace view_manager { | 18 namespace view_manager { |
19 namespace service { | 19 namespace service { |
20 | 20 |
21 class WindowTreeClientImpl : public aura::client::WindowTreeClient { | 21 class WindowTreeClientImpl : public aura::client::WindowTreeClient { |
(...skipping 18 matching lines...) Expand all Loading... |
40 } | 40 } |
41 | 41 |
42 private: | 42 private: |
43 aura::Window* window_; | 43 aura::Window* window_; |
44 | 44 |
45 scoped_ptr<aura::client::DefaultCaptureClient> capture_client_; | 45 scoped_ptr<aura::client::DefaultCaptureClient> capture_client_; |
46 | 46 |
47 DISALLOW_COPY_AND_ASSIGN(WindowTreeClientImpl); | 47 DISALLOW_COPY_AND_ASSIGN(WindowTreeClientImpl); |
48 }; | 48 }; |
49 | 49 |
50 RootViewManager::RootViewManager(ServiceProvider* service_provider, | 50 RootViewManager::RootViewManager(Shell* shell, RootNodeManager* root_node) |
51 RootNodeManager* root_node) | 51 : shell_(shell), |
52 : service_provider_(service_provider), | |
53 root_node_manager_(root_node), | 52 root_node_manager_(root_node), |
54 in_setup_(false) { | 53 in_setup_(false) { |
55 screen_.reset(ScreenMojo::Create()); | 54 screen_.reset(ScreenMojo::Create()); |
56 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, screen_.get()); | 55 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, screen_.get()); |
57 NativeViewportPtr viewport; | 56 NativeViewportPtr viewport; |
58 ConnectToService(service_provider, | 57 ConnectTo(shell, "mojo:mojo_native_viewport_service", &viewport); |
59 "mojo:mojo_native_viewport_service", | |
60 &viewport); | |
61 window_tree_host_.reset(new WindowTreeHostMojo( | 58 window_tree_host_.reset(new WindowTreeHostMojo( |
62 viewport.Pass(), | 59 viewport.Pass(), |
63 gfx::Rect(800, 600), | 60 gfx::Rect(800, 600), |
64 base::Bind(&RootViewManager::OnCompositorCreated, | 61 base::Bind(&RootViewManager::OnCompositorCreated, |
65 base::Unretained(this)))); | 62 base::Unretained(this)))); |
66 } | 63 } |
67 | 64 |
68 RootViewManager::~RootViewManager() { | 65 RootViewManager::~RootViewManager() { |
69 window_tree_client_.reset(); | 66 window_tree_client_.reset(); |
70 window_tree_host_.reset(); | 67 window_tree_host_.reset(); |
(...skipping 11 matching lines...) Expand all Loading... |
82 | 79 |
83 window_tree_client_.reset( | 80 window_tree_client_.reset( |
84 new WindowTreeClientImpl(window_tree_host_->window())); | 81 new WindowTreeClientImpl(window_tree_host_->window())); |
85 | 82 |
86 window_tree_host_->Show(); | 83 window_tree_host_->Show(); |
87 } | 84 } |
88 | 85 |
89 } // namespace service | 86 } // namespace service |
90 } // namespace view_manager | 87 } // namespace view_manager |
91 } // namespace mojo | 88 } // namespace mojo |
OLD | NEW |