 Chromium Code Reviews
 Chromium Code Reviews Issue 657583003:
  Chrome OS: Ash support for >=3 displays.  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master
    
  
    Issue 657583003:
  Chrome OS: Ash support for >=3 displays.  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master| OLD | NEW | 
|---|---|
| 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 "ui/display/chromeos/display_configurator.h" | 5 #include "ui/display/chromeos/display_configurator.h" | 
| 6 | 6 | 
| 7 #include "base/bind.h" | 7 #include "base/bind.h" | 
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" | 
| 9 #include "base/logging.h" | 9 #include "base/logging.h" | 
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" | 
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 54 case MULTIPLE_DISPLAY_STATE_INVALID: | 54 case MULTIPLE_DISPLAY_STATE_INVALID: | 
| 55 return "INVALID"; | 55 return "INVALID"; | 
| 56 case MULTIPLE_DISPLAY_STATE_HEADLESS: | 56 case MULTIPLE_DISPLAY_STATE_HEADLESS: | 
| 57 return "HEADLESS"; | 57 return "HEADLESS"; | 
| 58 case MULTIPLE_DISPLAY_STATE_SINGLE: | 58 case MULTIPLE_DISPLAY_STATE_SINGLE: | 
| 59 return "SINGLE"; | 59 return "SINGLE"; | 
| 60 case MULTIPLE_DISPLAY_STATE_DUAL_MIRROR: | 60 case MULTIPLE_DISPLAY_STATE_DUAL_MIRROR: | 
| 61 return "DUAL_MIRROR"; | 61 return "DUAL_MIRROR"; | 
| 62 case MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED: | 62 case MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED: | 
| 63 return "DUAL_EXTENDED"; | 63 return "DUAL_EXTENDED"; | 
| 64 case MULTIPLE_DISPLAY_STATE_MULTI_EXTENDED: | |
| 65 return "MULTI_EXTENDED"; | |
| 64 } | 66 } | 
| 65 NOTREACHED() << "Unknown state " << state; | 67 NOTREACHED() << "Unknown state " << state; | 
| 66 return "INVALID"; | 68 return "INVALID"; | 
| 67 } | 69 } | 
| 68 | 70 | 
| 69 // Returns the number of displays in |displays| that should be turned on, per | 71 // Returns the number of displays in |displays| that should be turned on, per | 
| 70 // |state|. If |display_power| is non-NULL, it is updated to contain the | 72 // |state|. If |display_power| is non-NULL, it is updated to contain the | 
| 71 // on/off state of each corresponding entry in |displays|. | 73 // on/off state of each corresponding entry in |displays|. | 
| 72 int GetDisplayPower( | 74 int GetDisplayPower( | 
| 73 const std::vector<DisplayConfigurator::DisplayState>& display_states, | 75 const std::vector<DisplayConfigurator::DisplayState>& display_states, | 
| (...skipping 797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 871 return false; | 873 return false; | 
| 872 } | 874 } | 
| 873 size = mode_info->size(); | 875 size = mode_info->size(); | 
| 874 | 876 | 
| 875 for (size_t i = 0; i < cached_displays_.size(); ++i) { | 877 for (size_t i = 0; i < cached_displays_.size(); ++i) { | 
| 876 DisplayState* state = &cached_displays_[i]; | 878 DisplayState* state = &cached_displays_[i]; | 
| 877 new_mode[i] = display_power[i] ? state->mirror_mode : NULL; | 879 new_mode[i] = display_power[i] ? state->mirror_mode : NULL; | 
| 878 } | 880 } | 
| 879 break; | 881 break; | 
| 880 } | 882 } | 
| 881 case MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED: { | 883 case MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED: | 
| 882 if (cached_displays_.size() != 2 || | 884 case MULTIPLE_DISPLAY_STATE_MULTI_EXTENDED: { | 
| 883 (num_on_displays != 0 && num_on_displays != 2)) { | 885 if ((display_state == MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED && | 
| 886 cached_displays_.size() != 2) || | |
| 887 (display_state == MULTIPLE_DISPLAY_STATE_MULTI_EXTENDED && | |
| 888 cached_displays_.size() <= 2) || | |
| 889 (num_on_displays != 0 && | |
| 890 num_on_displays != static_cast<int>(cached_displays_.size()))) { | |
| 884 LOG(WARNING) << "Ignoring request to enter extended mode with " | 891 LOG(WARNING) << "Ignoring request to enter extended mode with " | 
| 885 << cached_displays_.size() << " connected display(s) and " | 892 << cached_displays_.size() << " connected display(s) and " | 
| 886 << num_on_displays << " turned on"; | 893 << num_on_displays << " turned on"; | 
| 887 return false; | 894 return false; | 
| 888 } | 895 } | 
| 889 | 896 | 
| 890 for (size_t i = 0; i < cached_displays_.size(); ++i) { | 897 for (size_t i = 0; i < cached_displays_.size(); ++i) { | 
| 891 DisplayState* state = &cached_displays_[i]; | 898 DisplayState* state = &cached_displays_[i]; | 
| 892 new_origins[i].set_y(size.height() ? size.height() + kVerticalGap : 0); | 899 new_origins[i].set_y(size.height() ? size.height() + kVerticalGap : 0); | 
| 893 new_mode[i] = display_power[i] ? state->selected_mode : NULL; | 900 new_mode[i] = display_power[i] ? state->selected_mode : NULL; | 
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 992 return MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED; | 999 return MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED; | 
| 993 // With either both displays on or both displays off, use one of the | 1000 // With either both displays on or both displays off, use one of the | 
| 994 // dual modes. | 1001 // dual modes. | 
| 995 std::vector<int64_t> display_ids; | 1002 std::vector<int64_t> display_ids; | 
| 996 for (size_t i = 0; i < cached_displays_.size(); ++i) | 1003 for (size_t i = 0; i < cached_displays_.size(); ++i) | 
| 997 display_ids.push_back(cached_displays_[i].display->display_id()); | 1004 display_ids.push_back(cached_displays_[i].display->display_id()); | 
| 998 | 1005 | 
| 999 return state_controller_->GetStateForDisplayIds(display_ids); | 1006 return state_controller_->GetStateForDisplayIds(display_ids); | 
| 1000 } | 1007 } | 
| 1001 } | 1008 } | 
| 1002 default: | 1009 default: { | 
| 
oshima
2014/12/05 22:18:15
add comment that this is for >3 case.
 
hshi1
2014/12/05 23:25:12
Acknowledged.
 | |
| 1003 NOTREACHED(); | 1010 if (num_on_displays == 1) | 
| 1011 return MULTIPLE_DISPLAY_STATE_SINGLE; | |
| 
oshima
2014/12/05 22:18:15
don't you have to handle == 2 case?
 
hshi1
2014/12/05 23:25:13
I think it is actually better to just handle the c
 | |
| 1012 else | |
| 1013 return MULTIPLE_DISPLAY_STATE_MULTI_EXTENDED; | |
| 1014 } | |
| 1004 } | 1015 } | 
| 1005 return MULTIPLE_DISPLAY_STATE_INVALID; | 1016 return MULTIPLE_DISPLAY_STATE_INVALID; | 
| 1006 } | 1017 } | 
| 1007 | 1018 | 
| 1008 } // namespace ui | 1019 } // namespace ui | 
| OLD | NEW |