OLD | NEW |
---|---|
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_manager.h" | 5 #include "ash/display/display_manager.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
544 internal_display_connected = IsInternalDisplayId(iter->id()); | 544 internal_display_connected = IsInternalDisplayId(iter->id()); |
545 // Mirrored monitors have the same origins. | 545 // Mirrored monitors have the same origins. |
546 gfx::Point origin = iter->bounds_in_native().origin(); | 546 gfx::Point origin = iter->bounds_in_native().origin(); |
547 if (origins.find(origin) != origins.end()) { | 547 if (origins.find(origin) != origins.end()) { |
548 InsertAndUpdateDisplayInfo(*iter); | 548 InsertAndUpdateDisplayInfo(*iter); |
549 mirrored_display_id_ = iter->id(); | 549 mirrored_display_id_ = iter->id(); |
550 } else { | 550 } else { |
551 origins.insert(origin); | 551 origins.insert(origin); |
552 new_display_info_list.push_back(*iter); | 552 new_display_info_list.push_back(*iter); |
553 } | 553 } |
554 | |
555 const gfx::Size& resolution = iter->bounds_in_native().size(); | |
dsodman
2013/12/16 18:15:17
should not be a reference
oshima
2013/12/16 18:50:56
This is actually a bug in DisplayInfo, but I'll fi
| |
556 const std::vector<Resolution>& resolutions = iter->resolutions(); | |
557 // This is empty the displays are initialized from InitFromCommandLine. | |
558 if (!resolutions.size()) | |
559 continue; | |
560 std::vector<Resolution>::const_iterator resolution_iter = | |
561 std::find_if(resolutions.begin(), | |
562 resolutions.end(), | |
563 ResolutionMatcher(resolution)); | |
564 // Update the actual resolution selected as the resolution request may fail. | |
565 if (resolution_iter == resolutions.begin()) | |
566 resolutions_.erase(iter->id()); | |
567 else if (resolutions_.find(iter->id()) != resolutions_.end()) | |
568 resolutions_[iter->id()] = resolution; | |
554 } | 569 } |
555 if (HasInternalDisplay() && | 570 if (HasInternalDisplay() && |
556 !internal_display_connected && | 571 !internal_display_connected && |
557 display_info_.find(gfx::Display::InternalDisplayId()) == | 572 display_info_.find(gfx::Display::InternalDisplayId()) == |
558 display_info_.end()) { | 573 display_info_.end()) { |
559 DisplayInfo internal_display_info( | 574 DisplayInfo internal_display_info( |
560 gfx::Display::InternalDisplayId(), | 575 gfx::Display::InternalDisplayId(), |
561 l10n_util::GetStringUTF8(IDS_ASH_INTERNAL_DISPLAY_NAME), | 576 l10n_util::GetStringUTF8(IDS_ASH_INTERNAL_DISPLAY_NAME), |
562 false /*Internal display must not have overscan */); | 577 false /*Internal display must not have overscan */); |
563 internal_display_info.SetBounds(gfx::Rect(0, 0, 800, 600)); | 578 internal_display_info.SetBounds(gfx::Rect(0, 0, 800, 600)); |
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1039 break; | 1054 break; |
1040 } | 1055 } |
1041 gfx::Insets insets = secondary_display->GetWorkAreaInsets(); | 1056 gfx::Insets insets = secondary_display->GetWorkAreaInsets(); |
1042 secondary_display->set_bounds( | 1057 secondary_display->set_bounds( |
1043 gfx::Rect(new_secondary_origin, secondary_bounds.size())); | 1058 gfx::Rect(new_secondary_origin, secondary_bounds.size())); |
1044 secondary_display->UpdateWorkAreaFromInsets(insets); | 1059 secondary_display->UpdateWorkAreaFromInsets(insets); |
1045 } | 1060 } |
1046 | 1061 |
1047 } // namespace internal | 1062 } // namespace internal |
1048 } // namespace ash | 1063 } // namespace ash |
OLD | NEW |