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

Side by Side Diff: services/ui/display/platform_screen_ozone.cc

Issue 2503923003: Demonstrate external-window-mode in mus-demo (Closed)
Patch Set: Move CommandLine into OnStart Created 4 years, 1 month 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/display/platform_screen_ozone.h" 5 #include "services/ui/display/platform_screen_ozone.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/memory/ptr_util.h" 11 #include "base/memory/ptr_util.h"
12 #include "base/sys_info.h" 12 #include "base/sys_info.h"
13 #include "base/threading/thread_task_runner_handle.h" 13 #include "base/threading/thread_task_runner_handle.h"
14 #include "services/service_manager/public/cpp/interface_registry.h" 14 #include "services/service_manager/public/cpp/interface_registry.h"
15 #include "third_party/skia/include/core/SkColor.h" 15 #include "third_party/skia/include/core/SkColor.h"
16 #include "ui/display/types/display_constants.h" 16 #include "ui/display/types/display_constants.h"
17 #include "ui/display/types/display_snapshot.h" 17 #include "ui/display/types/display_snapshot.h"
18 #include "ui/display/types/native_display_delegate.h" 18 #include "ui/display/types/native_display_delegate.h"
19 #include "ui/gfx/geometry/rect.h" 19 #include "ui/gfx/geometry/rect.h"
20 #include "ui/ozone/public/ozone_platform.h" 20 #include "ui/ozone/public/ozone_platform.h"
21 #include "ui/ozone/public/ozone_switches.h"
21 22
22 namespace display { 23 namespace display {
23 namespace { 24 namespace {
24 25
25 // Needed for DisplayConfigurator::ForceInitialConfigure. 26 // Needed for DisplayConfigurator::ForceInitialConfigure.
26 const SkColor kChromeOsBootColor = SkColorSetRGB(0xfe, 0xfe, 0xfe); 27 const SkColor kChromeOsBootColor = SkColorSetRGB(0xfe, 0xfe, 0xfe);
27 28
28 const float kInchInMm = 25.4f; 29 const float kInchInMm = 25.4f;
29 30
30 float ComputeDisplayDPI(const gfx::Size& pixel_size, 31 float ComputeDisplayDPI(const gfx::Size& pixel_size,
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 std::unique_ptr<ui::NativeDisplayDelegate> native_display_delegate = 76 std::unique_ptr<ui::NativeDisplayDelegate> native_display_delegate =
76 ui::OzonePlatform::GetInstance()->CreateNativeDisplayDelegate(); 77 ui::OzonePlatform::GetInstance()->CreateNativeDisplayDelegate();
77 78
78 // The FakeDisplayController gives us a way to make the NativeDisplayDelegate 79 // The FakeDisplayController gives us a way to make the NativeDisplayDelegate
79 // pretend something display related has happened. 80 // pretend something display related has happened.
80 if (!base::SysInfo::IsRunningOnChromeOS()) { 81 if (!base::SysInfo::IsRunningOnChromeOS()) {
81 fake_display_controller_ = 82 fake_display_controller_ =
82 native_display_delegate->GetFakeDisplayController(); 83 native_display_delegate->GetFakeDisplayController();
83 } 84 }
84 85
86 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
rjkroege 2016/11/21 21:19:11 This doesn't seem like the right approach. The cod
Tom (Use chromium acct) 2016/11/22 02:48:15 Done.
87 switches::kExternalWindowMode))
88 return;
89
85 // We want display configuration to happen even off device to keep the control 90 // We want display configuration to happen even off device to keep the control
86 // flow similar. 91 // flow similar.
87 display_configurator_.set_configure_display(true); 92 display_configurator_.set_configure_display(true);
88 display_configurator_.AddObserver(this); 93 display_configurator_.AddObserver(this);
89 display_configurator_.set_state_controller(this); 94 display_configurator_.set_state_controller(this);
90 display_configurator_.Init(std::move(native_display_delegate), false); 95 display_configurator_.Init(std::move(native_display_delegate), false);
91 display_configurator_.ForceInitialConfigure(kChromeOsBootColor); 96 display_configurator_.ForceInitialConfigure(kChromeOsBootColor);
92 } 97 }
93 98
94 void PlatformScreenOzone::RequestCloseDisplay(int64_t display_id) { 99 void PlatformScreenOzone::RequestCloseDisplay(int64_t display_id) {
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 return false; 381 return false;
377 } 382 }
378 383
379 void PlatformScreenOzone::Create( 384 void PlatformScreenOzone::Create(
380 const service_manager::Identity& remote_identity, 385 const service_manager::Identity& remote_identity,
381 mojom::TestDisplayControllerRequest request) { 386 mojom::TestDisplayControllerRequest request) {
382 test_bindings_.AddBinding(this, std::move(request)); 387 test_bindings_.AddBinding(this, std::move(request));
383 } 388 }
384 389
385 } // namespace display 390 } // namespace display
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698