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

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

Issue 13947019: Clean up selected ash defines for MessagePumpLinux (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: correctly fixed merge conflict Created 7 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
« no previous file with comments | « no previous file | ash/shell.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_controller.h" 5 #include "ash/display/display_controller.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <map> 9 #include <map>
10 10
(...skipping 24 matching lines...) Expand all
35 #include "ui/aura/root_window.h" 35 #include "ui/aura/root_window.h"
36 #include "ui/aura/window.h" 36 #include "ui/aura/window.h"
37 #include "ui/aura/window_property.h" 37 #include "ui/aura/window_property.h"
38 #include "ui/aura/window_tracker.h" 38 #include "ui/aura/window_tracker.h"
39 #include "ui/compositor/compositor.h" 39 #include "ui/compositor/compositor.h"
40 #include "ui/compositor/dip_util.h" 40 #include "ui/compositor/dip_util.h"
41 #include "ui/gfx/display.h" 41 #include "ui/gfx/display.h"
42 #include "ui/gfx/screen.h" 42 #include "ui/gfx/screen.h"
43 43
44 #if defined(OS_CHROMEOS) 44 #if defined(OS_CHROMEOS)
45 #include "ash/display/output_configurator_animation.h"
46 #include "base/chromeos/chromeos_version.h" 45 #include "base/chromeos/chromeos_version.h"
47 #include "base/time.h" 46 #include "base/time.h"
47 #if defined(USE_X11)
48 #include "ash/display/output_configurator_animation.h"
48 #include "chromeos/display/output_configurator.h" 49 #include "chromeos/display/output_configurator.h"
49 #include "ui/base/x/x11_util.h" 50 #include "ui/base/x/x11_util.h"
50 51
51 // Including this at the bottom to avoid other 52 // Including this at the bottom to avoid other
52 // potential conflict with chrome headers. 53 // potential conflict with chrome headers.
53 #include <X11/extensions/Xrandr.h> 54 #include <X11/extensions/Xrandr.h>
54 #undef RootWindow 55 #undef RootWindow
56 #endif // defined(USE_X11)
55 #endif // defined(OS_CHROMEOS) 57 #endif // defined(OS_CHROMEOS)
56 58
57 namespace ash { 59 namespace ash {
58 namespace { 60 namespace {
59 61
60 // Primary display stored in global object as it can be 62 // Primary display stored in global object as it can be
61 // accessed after Shell is deleted. A separate display instance is created 63 // accessed after Shell is deleted. A separate display instance is created
62 // during the shutdown instead of always keeping two display instances 64 // during the shutdown instead of always keeping two display instances
63 // (one here and another one in display_manager) in sync, which is error prone. 65 // (one here and another one in display_manager) in sync, which is error prone.
64 int64 primary_display_id = gfx::Display::kInvalidDisplayID; 66 int64 primary_display_id = gfx::Display::kInvalidDisplayID;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 } 123 }
122 124
123 internal::DisplayManager* GetDisplayManager() { 125 internal::DisplayManager* GetDisplayManager() {
124 return Shell::GetInstance()->display_manager(); 126 return Shell::GetInstance()->display_manager();
125 } 127 }
126 128
127 void SetDisplayPropertiesOnHostWindow(aura::RootWindow* root, 129 void SetDisplayPropertiesOnHostWindow(aura::RootWindow* root,
128 const gfx::Display& display) { 130 const gfx::Display& display) {
129 internal::DisplayInfo info = 131 internal::DisplayInfo info =
130 GetDisplayManager()->GetDisplayInfo(display.id()); 132 GetDisplayManager()->GetDisplayInfo(display.id());
131 #if defined(OS_CHROMEOS) 133 #if defined(OS_CHROMEOS) && defined(USE_X11)
132 // Native window property (Atom in X11) that specifies the display's 134 // Native window property (Atom in X11) that specifies the display's
133 // rotation, scale factor and if it's internal display. They are 135 // rotation, scale factor and if it's internal display. They are
134 // read and used by touchpad/mouse driver directly on X (contact 136 // read and used by touchpad/mouse driver directly on X (contact
135 // adlr@ for more details on touchpad/mouse driver side). The value 137 // adlr@ for more details on touchpad/mouse driver side). The value
136 // of the rotation is one of 0 (normal), 1 (90 degrees clockwise), 2 138 // of the rotation is one of 0 (normal), 1 (90 degrees clockwise), 2
137 // (180 degree) or 3 (270 degrees clockwise). The value of the 139 // (180 degree) or 3 (270 degrees clockwise). The value of the
138 // scale factor is in percent (100, 140, 200 etc). 140 // scale factor is in percent (100, 140, 200 etc).
139 const char kRotationProp[] = "_CHROME_DISPLAY_ROTATION"; 141 const char kRotationProp[] = "_CHROME_DISPLAY_ROTATION";
140 const char kScaleFactorProp[] = "_CHROME_DISPLAY_SCALE_FACTOR"; 142 const char kScaleFactorProp[] = "_CHROME_DISPLAY_SCALE_FACTOR";
141 const char kInternalProp[] = "_CHROME_DISPLAY_INTERNAL"; 143 const char kInternalProp[] = "_CHROME_DISPLAY_INTERNAL";
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 paired_layouts_.find(pair); 619 paired_layouts_.find(pair);
618 return iter != paired_layouts_.end() ? iter->second : default_display_layout_; 620 return iter != paired_layouts_.end() ? iter->second : default_display_layout_;
619 } 621 }
620 622
621 void DisplayController::CycleDisplayMode() { 623 void DisplayController::CycleDisplayMode() {
622 if (limiter_) { 624 if (limiter_) {
623 if (limiter_->IsThrottled()) 625 if (limiter_->IsThrottled())
624 return; 626 return;
625 limiter_->SetThrottleTimeout(kCycleDisplayThrottleTimeoutMs); 627 limiter_->SetThrottleTimeout(kCycleDisplayThrottleTimeoutMs);
626 } 628 }
627 #if defined(OS_CHROMEOS) 629 #if defined(OS_CHROMEOS) && defined(USE_X11)
628 Shell* shell = Shell::GetInstance(); 630 Shell* shell = Shell::GetInstance();
629 internal::DisplayManager* display_manager = GetDisplayManager(); 631 internal::DisplayManager* display_manager = GetDisplayManager();
630 if (!base::chromeos::IsRunningOnChromeOS()) { 632 if (!base::chromeos::IsRunningOnChromeOS()) {
631 internal::DisplayManager::CycleDisplay(); 633 internal::DisplayManager::CycleDisplay();
632 } else if (display_manager->num_connected_displays() > 1) { 634 } else if (display_manager->num_connected_displays() > 1) {
633 chromeos::OutputState new_state = display_manager->IsMirrored() ? 635 chromeos::OutputState new_state = display_manager->IsMirrored() ?
634 chromeos::STATE_DUAL_EXTENDED : chromeos::STATE_DUAL_MIRROR; 636 chromeos::STATE_DUAL_EXTENDED : chromeos::STATE_DUAL_MIRROR;
635 internal::OutputConfiguratorAnimation* animation = 637 internal::OutputConfiguratorAnimation* animation =
636 shell->output_configurator_animation(); 638 shell->output_configurator_animation();
637 animation->StartFadeOutAnimation(base::Bind( 639 animation->StartFadeOutAnimation(base::Bind(
638 base::IgnoreResult(&chromeos::OutputConfigurator::SetDisplayMode), 640 base::IgnoreResult(&chromeos::OutputConfigurator::SetDisplayMode),
639 base::Unretained(shell->output_configurator()), 641 base::Unretained(shell->output_configurator()),
640 new_state)); 642 new_state));
641 } 643 }
642 #endif 644 #endif
643 } 645 }
644 646
645 void DisplayController::SwapPrimaryDisplay() { 647 void DisplayController::SwapPrimaryDisplay() {
646 if (limiter_) { 648 if (limiter_) {
647 if (limiter_->IsThrottled()) 649 if (limiter_->IsThrottled())
648 return; 650 return;
649 limiter_->SetThrottleTimeout(kSwapDisplayThrottleTimeoutMs); 651 limiter_->SetThrottleTimeout(kSwapDisplayThrottleTimeoutMs);
650 } 652 }
651 653
652 if (Shell::GetScreen()->GetNumDisplays() > 1) { 654 if (Shell::GetScreen()->GetNumDisplays() > 1) {
653 #if defined(OS_CHROMEOS) 655 #if defined(OS_CHROMEOS) && defined(USE_X11)
654 internal::OutputConfiguratorAnimation* animation = 656 internal::OutputConfiguratorAnimation* animation =
655 Shell::GetInstance()->output_configurator_animation(); 657 Shell::GetInstance()->output_configurator_animation();
656 if (animation) { 658 if (animation) {
657 animation->StartFadeOutAnimation(base::Bind( 659 animation->StartFadeOutAnimation(base::Bind(
658 &DisplayController::OnFadeOutForSwapDisplayFinished, 660 &DisplayController::OnFadeOutForSwapDisplayFinished,
659 base::Unretained(this))); 661 base::Unretained(this)));
660 } else { 662 } else {
661 SetPrimaryDisplay(ScreenAsh::GetSecondaryDisplay()); 663 SetPrimaryDisplay(ScreenAsh::GetSecondaryDisplay());
662 } 664 }
663 #else 665 #else
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
1026 int64 id1, 1028 int64 id1,
1027 int64 id2, 1029 int64 id2,
1028 const DisplayLayout& layout, 1030 const DisplayLayout& layout,
1029 bool override) { 1031 bool override) {
1030 DisplayIdPair pair = std::make_pair(id1, id2); 1032 DisplayIdPair pair = std::make_pair(id1, id2);
1031 if (override || paired_layouts_.find(pair) == paired_layouts_.end()) 1033 if (override || paired_layouts_.find(pair) == paired_layouts_.end())
1032 paired_layouts_[pair] = layout; 1034 paired_layouts_[pair] = layout;
1033 } 1035 }
1034 1036
1035 void DisplayController::OnFadeOutForSwapDisplayFinished() { 1037 void DisplayController::OnFadeOutForSwapDisplayFinished() {
1036 #if defined(OS_CHROMEOS) 1038 #if defined(OS_CHROMEOS) && defined(USE_X11)
1037 SetPrimaryDisplay(ScreenAsh::GetSecondaryDisplay()); 1039 SetPrimaryDisplay(ScreenAsh::GetSecondaryDisplay());
1038 Shell::GetInstance()->output_configurator_animation()->StartFadeInAnimation(); 1040 Shell::GetInstance()->output_configurator_animation()->StartFadeInAnimation();
1039 #endif 1041 #endif
1040 } 1042 }
1041 1043
1042 } // namespace ash 1044 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/shell.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698