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

Side by Side Diff: ash/display/display_configuration_controller.cc

Issue 2631623003: Remove some ifdefs from ash since it only supports ChromeOS now. (Closed)
Patch Set: revert x11 change 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 | « no previous file | ash/display/display_util.h » ('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 "ash/display/display_configuration_controller.h" 5 #include "ash/display/display_configuration_controller.h"
6 6
7 #include "ash/display/display_animator.h" 7 #include "ash/display/display_animator.h"
8 #include "ash/display/display_animator_chromeos.h"
8 #include "ash/display/display_util.h" 9 #include "ash/display/display_util.h"
9 #include "ash/rotator/screen_rotation_animator.h" 10 #include "ash/rotator/screen_rotation_animator.h"
10 #include "base/time/time.h" 11 #include "base/time/time.h"
12 #include "chromeos/system/devicemode.h"
13 #include "grit/ash_strings.h"
14 #include "ui/base/l10n/l10n_util.h"
11 #include "ui/display/display_layout.h" 15 #include "ui/display/display_layout.h"
12 #include "ui/display/manager/display_manager.h" 16 #include "ui/display/manager/display_manager.h"
13 17
14 #if defined(OS_CHROMEOS)
15 #include "ash/display/display_animator_chromeos.h"
16 #include "chromeos/system/devicemode.h"
17 #include "grit/ash_strings.h"
18 #include "ui/base/l10n/l10n_util.h"
19 #endif
20
21 namespace { 18 namespace {
22 19
23 // Specifies how long the display change should have been disabled 20 // Specifies how long the display change should have been disabled
24 // after each display change operations. 21 // after each display change operations.
25 // |kCycleDisplayThrottleTimeoutMs| is set to be longer to avoid 22 // |kCycleDisplayThrottleTimeoutMs| is set to be longer to avoid
26 // changing the settings while the system is still configurating 23 // changing the settings while the system is still configurating
27 // displays. It will be overriden by |kAfterDisplayChangeThrottleTimeoutMs| 24 // displays. It will be overriden by |kAfterDisplayChangeThrottleTimeoutMs|
28 // when the display change happens, so the actual timeout is much shorter. 25 // when the display change happens, so the actual timeout is much shorter.
29 const int64_t kAfterDisplayChangeThrottleTimeoutMs = 500; 26 const int64_t kAfterDisplayChangeThrottleTimeoutMs = 500;
30 const int64_t kCycleDisplayThrottleTimeoutMs = 4000; 27 const int64_t kCycleDisplayThrottleTimeoutMs = 4000;
(...skipping 20 matching lines...) Expand all
51 DISALLOW_COPY_AND_ASSIGN(DisplayChangeLimiter); 48 DISALLOW_COPY_AND_ASSIGN(DisplayChangeLimiter);
52 }; 49 };
53 50
54 DisplayConfigurationController::DisplayConfigurationController( 51 DisplayConfigurationController::DisplayConfigurationController(
55 display::DisplayManager* display_manager, 52 display::DisplayManager* display_manager,
56 WindowTreeHostManager* window_tree_host_manager) 53 WindowTreeHostManager* window_tree_host_manager)
57 : display_manager_(display_manager), 54 : display_manager_(display_manager),
58 window_tree_host_manager_(window_tree_host_manager), 55 window_tree_host_manager_(window_tree_host_manager),
59 weak_ptr_factory_(this) { 56 weak_ptr_factory_(this) {
60 window_tree_host_manager_->AddObserver(this); 57 window_tree_host_manager_->AddObserver(this);
61 #if defined(OS_CHROMEOS)
62 if (chromeos::IsRunningAsSystemCompositor()) 58 if (chromeos::IsRunningAsSystemCompositor())
63 limiter_.reset(new DisplayChangeLimiter); 59 limiter_.reset(new DisplayChangeLimiter);
64 display_animator_.reset(new DisplayAnimatorChromeOS()); 60 display_animator_.reset(new DisplayAnimatorChromeOS());
65 #endif
66 } 61 }
67 62
68 DisplayConfigurationController::~DisplayConfigurationController() { 63 DisplayConfigurationController::~DisplayConfigurationController() {
69 window_tree_host_manager_->RemoveObserver(this); 64 window_tree_host_manager_->RemoveObserver(this);
70 } 65 }
71 66
72 void DisplayConfigurationController::SetDisplayLayout( 67 void DisplayConfigurationController::SetDisplayLayout(
73 std::unique_ptr<display::DisplayLayout> layout, 68 std::unique_ptr<display::DisplayLayout> layout,
74 bool user_action) { 69 bool user_action) {
75 if (user_action && display_animator_) { 70 if (user_action && display_animator_) {
76 display_animator_->StartFadeOutAnimation( 71 display_animator_->StartFadeOutAnimation(
77 base::Bind(&DisplayConfigurationController::SetDisplayLayoutImpl, 72 base::Bind(&DisplayConfigurationController::SetDisplayLayoutImpl,
78 weak_ptr_factory_.GetWeakPtr(), base::Passed(&layout))); 73 weak_ptr_factory_.GetWeakPtr(), base::Passed(&layout)));
79 } else { 74 } else {
80 SetDisplayLayoutImpl(std::move(layout)); 75 SetDisplayLayoutImpl(std::move(layout));
81 } 76 }
82 } 77 }
83 78
84 void DisplayConfigurationController::SetMirrorMode(bool mirror, 79 void DisplayConfigurationController::SetMirrorMode(bool mirror,
85 bool user_action) { 80 bool user_action) {
86 if (display_manager_->num_connected_displays() > 2) { 81 if (display_manager_->num_connected_displays() > 2) {
87 #if defined(OS_CHROMEOS)
88 if (user_action) { 82 if (user_action) {
89 ShowDisplayErrorNotification( 83 ShowDisplayErrorNotification(
90 l10n_util::GetStringUTF16(IDS_ASH_DISPLAY_MIRRORING_NOT_SUPPORTED), 84 l10n_util::GetStringUTF16(IDS_ASH_DISPLAY_MIRRORING_NOT_SUPPORTED),
91 false); 85 false);
92 } 86 }
93 #endif
94 return; 87 return;
95 } 88 }
96 if (display_manager_->num_connected_displays() <= 1 || 89 if (display_manager_->num_connected_displays() <= 1 ||
97 display_manager_->IsInMirrorMode() == mirror || IsLimited()) { 90 display_manager_->IsInMirrorMode() == mirror || IsLimited()) {
98 return; 91 return;
99 } 92 }
100 SetThrottleTimeout(kCycleDisplayThrottleTimeoutMs); 93 SetThrottleTimeout(kCycleDisplayThrottleTimeoutMs);
101 if (user_action && display_animator_) { 94 if (user_action && display_animator_) {
102 display_animator_->StartFadeOutAnimation( 95 display_animator_->StartFadeOutAnimation(
103 base::Bind(&DisplayConfigurationController::SetMirrorModeImpl, 96 base::Bind(&DisplayConfigurationController::SetMirrorModeImpl,
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 } 166 }
174 167
175 void DisplayConfigurationController::SetPrimaryDisplayIdImpl( 168 void DisplayConfigurationController::SetPrimaryDisplayIdImpl(
176 int64_t display_id) { 169 int64_t display_id) {
177 window_tree_host_manager_->SetPrimaryDisplayId(display_id); 170 window_tree_host_manager_->SetPrimaryDisplayId(display_id);
178 if (display_animator_) 171 if (display_animator_)
179 display_animator_->StartFadeInAnimation(); 172 display_animator_->StartFadeInAnimation();
180 } 173 }
181 174
182 } // namespace ash 175 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/display/display_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698