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

Side by Side Diff: mojo/services/view_manager/root_view_manager.cc

Issue 265793015: Mojo: Replace RemotePtr with InterfacePtr and InterfaceImpl (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 7 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 | Annotate | Revision Log
OLDNEW
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/bindings/allocation_scope.h" 10 #include "mojo/public/cpp/shell/service.h"
11 #include "mojo/public/interfaces/shell/shell.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 services { 18 namespace services {
19 namespace view_manager { 19 namespace view_manager {
20 20
(...skipping 25 matching lines...) Expand all
46 46
47 DISALLOW_COPY_AND_ASSIGN(WindowTreeClientImpl); 47 DISALLOW_COPY_AND_ASSIGN(WindowTreeClientImpl);
48 }; 48 };
49 49
50 RootViewManager::RootViewManager(Shell* shell, RootNodeManager* root_node) 50 RootViewManager::RootViewManager(Shell* shell, RootNodeManager* root_node)
51 : shell_(shell), 51 : shell_(shell),
52 root_node_manager_(root_node), 52 root_node_manager_(root_node),
53 in_setup_(false) { 53 in_setup_(false) {
54 screen_.reset(ScreenMojo::Create()); 54 screen_.reset(ScreenMojo::Create());
55 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, screen_.get()); 55 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, screen_.get());
56 InterfacePipe<NativeViewport, AnyInterface> pipe; 56 NativeViewportPtr viewport;
57 mojo::AllocationScope scope; 57 ConnectTo(shell, "mojo:mojo_native_viewport_service", &viewport);
58 shell_->Connect("mojo:mojo_native_viewport_service",
59 pipe.handle_to_peer.Pass());
60 window_tree_host_.reset(new WindowTreeHostMojo( 58 window_tree_host_.reset(new WindowTreeHostMojo(
61 pipe.handle_to_self.Pass(), 59 viewport.Pass(),
62 gfx::Rect(800, 600), 60 gfx::Rect(800, 600),
63 base::Bind(&RootViewManager::OnCompositorCreated, 61 base::Bind(&RootViewManager::OnCompositorCreated,
64 base::Unretained(this)))); 62 base::Unretained(this))));
65 } 63 }
66 64
67 RootViewManager::~RootViewManager() { 65 RootViewManager::~RootViewManager() {
68 window_tree_client_.reset(); 66 window_tree_client_.reset();
69 window_tree_host_.reset(); 67 window_tree_host_.reset();
70 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, NULL); 68 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, NULL);
71 } 69 }
72 70
73 void RootViewManager::OnCompositorCreated() { 71 void RootViewManager::OnCompositorCreated() {
74 base::AutoReset<bool> resetter(&in_setup_, true); 72 base::AutoReset<bool> resetter(&in_setup_, true);
75 window_tree_host_->InitHost(); 73 window_tree_host_->InitHost();
76 74
77 aura::Window* root = root_node_manager_->root()->window(); 75 aura::Window* root = root_node_manager_->root()->window();
78 window_tree_host_->window()->AddChild(root); 76 window_tree_host_->window()->AddChild(root);
79 root->SetBounds(gfx::Rect(window_tree_host_->window()->bounds().size())); 77 root->SetBounds(gfx::Rect(window_tree_host_->window()->bounds().size()));
80 root_node_manager_->root()->window()->Show(); 78 root_node_manager_->root()->window()->Show();
81 79
82 window_tree_client_.reset( 80 window_tree_client_.reset(
83 new WindowTreeClientImpl(window_tree_host_->window())); 81 new WindowTreeClientImpl(window_tree_host_->window()));
84 82
85 window_tree_host_->Show(); 83 window_tree_host_->Show();
86 } 84 }
87 85
88 } // namespace view_manager 86 } // namespace view_manager
89 } // namespace services 87 } // namespace services
90 } // namespace mojo 88 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698