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

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

Issue 2644093002: aura: Some change to how the client-lib is set up. (Closed)
Patch Set: . Created 3 years, 11 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.h ('k') | services/ui/test_wm/test_wm.cc » ('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 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/demo/mus_demo.h" 5 #include "services/ui/demo/mus_demo.h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "base/time/time.h" 8 #include "base/time/time.h"
9 #include "services/service_manager/public/cpp/connector.h" 9 #include "services/service_manager/public/cpp/connector.h"
10 #include "services/service_manager/public/cpp/service_context.h" 10 #include "services/service_manager/public/cpp/service_context.h"
11 #include "services/ui/public/cpp/gpu/gpu.h" 11 #include "services/ui/public/cpp/gpu/gpu.h"
12 #include "third_party/skia/include/core/SkBitmap.h" 12 #include "third_party/skia/include/core/SkBitmap.h"
13 #include "third_party/skia/include/core/SkCanvas.h" 13 #include "third_party/skia/include/core/SkCanvas.h"
14 #include "third_party/skia/include/core/SkColor.h" 14 #include "third_party/skia/include/core/SkColor.h"
15 #include "third_party/skia/include/core/SkImageInfo.h" 15 #include "third_party/skia/include/core/SkImageInfo.h"
16 #include "third_party/skia/include/core/SkPaint.h" 16 #include "third_party/skia/include/core/SkPaint.h"
17 #include "third_party/skia/include/core/SkRect.h" 17 #include "third_party/skia/include/core/SkRect.h"
18 #include "ui/aura/client/default_capture_client.h" 18 #include "ui/aura/client/default_capture_client.h"
19 #include "ui/aura/env.h" 19 #include "ui/aura/env.h"
20 #include "ui/aura/mus/mus_context_factory.h"
21 #include "ui/aura/mus/property_converter.h" 20 #include "ui/aura/mus/property_converter.h"
22 #include "ui/aura/mus/window_tree_client.h" 21 #include "ui/aura/mus/window_tree_client.h"
23 #include "ui/aura/mus/window_tree_host_mus.h" 22 #include "ui/aura/mus/window_tree_host_mus.h"
24 #include "ui/aura/window.h" 23 #include "ui/aura/window.h"
25 #include "ui/aura_extra/image_window_delegate.h" 24 #include "ui/aura_extra/image_window_delegate.h"
26 #include "ui/gfx/geometry/rect.h" 25 #include "ui/gfx/geometry/rect.h"
27 #include "ui/gfx/image/image.h" 26 #include "ui/gfx/image/image.h"
28 #include "ui/wm/core/wm_state.h" 27 #include "ui/wm/core/wm_state.h"
29 28
30 namespace ui { 29 namespace ui {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 75
77 void MusDemo::OnStart() { 76 void MusDemo::OnStart() {
78 screen_ = base::MakeUnique<display::ScreenBase>(); 77 screen_ = base::MakeUnique<display::ScreenBase>();
79 display::Screen::SetScreenInstance(screen_.get()); 78 display::Screen::SetScreenInstance(screen_.get());
80 79
81 env_ = aura::Env::CreateInstance(aura::Env::Mode::MUS); 80 env_ = aura::Env::CreateInstance(aura::Env::Mode::MUS);
82 capture_client_ = base::MakeUnique<aura::client::DefaultCaptureClient>(); 81 capture_client_ = base::MakeUnique<aura::client::DefaultCaptureClient>();
83 property_converter_ = base::MakeUnique<aura::PropertyConverter>(); 82 property_converter_ = base::MakeUnique<aura::PropertyConverter>();
84 wm_state_ = base::MakeUnique<::wm::WMState>(); 83 wm_state_ = base::MakeUnique<::wm::WMState>();
85 84
86 gpu_ = Gpu::Create(context()->connector());
87 context_factory_ = base::MakeUnique<aura::MusContextFactory>(gpu_.get());
88 env_->set_context_factory(context_factory_.get());
89
90 window_tree_client_ = base::MakeUnique<aura::WindowTreeClient>( 85 window_tree_client_ = base::MakeUnique<aura::WindowTreeClient>(
91 context()->connector(), this, this); 86 context()->connector(), this, this);
92 window_tree_client_->ConnectAsWindowManager(); 87 window_tree_client_->ConnectAsWindowManager();
93 88
94 env_->SetWindowTreeClient(window_tree_client_.get()); 89 env_->SetWindowTreeClient(window_tree_client_.get());
95 } 90 }
96 91
97 bool MusDemo::OnConnect(const service_manager::ServiceInfo& remote_info, 92 bool MusDemo::OnConnect(const service_manager::ServiceInfo& remote_info,
98 service_manager::InterfaceRegistry* registry) { 93 service_manager::InterfaceRegistry* registry) {
99 return true; 94 return true;
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 gfx::ImageSkiaRep image_skia_rep(bitmap, 1); 242 gfx::ImageSkiaRep image_skia_rep(bitmap, 1);
248 gfx::ImageSkia image_skia(image_skia_rep); 243 gfx::ImageSkia image_skia(image_skia_rep);
249 gfx::Image image(image_skia); 244 gfx::Image image(image_skia);
250 245
251 window_delegate_->SetImage(image); 246 window_delegate_->SetImage(image);
252 bitmap_window_->SchedulePaintInRect(bitmap_window_->bounds()); 247 bitmap_window_->SchedulePaintInRect(bitmap_window_->bounds());
253 } 248 }
254 249
255 } // namespace demo 250 } // namespace demo
256 } // namespace aura 251 } // namespace aura
OLDNEW
« no previous file with comments | « services/ui/demo/mus_demo.h ('k') | services/ui/test_wm/test_wm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698