| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <stdio.h> | 5 #include <stdio.h> |
| 6 | 6 |
| 7 #include "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
| 8 #include "ash/display/display_layout_store.h" | 8 #include "ash/display/display_layout_store.h" |
| 9 #include "ash/display/display_manager.h" | 9 #include "ash/display/display_manager.h" |
| 10 #include "ash/display/display_util.h" | 10 #include "ash/display/display_util.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 void DisplayLayoutStore::SetDefaultDisplayPlacement( | 43 void DisplayLayoutStore::SetDefaultDisplayPlacement( |
| 44 const DisplayPlacement& placement) { | 44 const DisplayPlacement& placement) { |
| 45 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 45 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 46 if (!command_line->HasSwitch(switches::kAshSecondaryDisplayLayout)) | 46 if (!command_line->HasSwitch(switches::kAshSecondaryDisplayLayout)) |
| 47 default_display_placement_ = placement; | 47 default_display_placement_ = placement; |
| 48 } | 48 } |
| 49 | 49 |
| 50 void DisplayLayoutStore::RegisterLayoutForDisplayIdList( | 50 void DisplayLayoutStore::RegisterLayoutForDisplayIdList( |
| 51 const DisplayIdList& list, | 51 const DisplayIdList& list, |
| 52 scoped_ptr<DisplayLayout> layout) { | 52 scoped_ptr<DisplayLayout> layout) { |
| 53 // A dev/beta channel may have a bad layout data saved in local state. | 53 // m50/51 dev/beta channel may have bad layout data saved in local state. |
| 54 // TODO(oshima): Consider removing this a coulpe of milestones later. | 54 // TODO(oshima): Consider removing this after m53. |
| 55 if (list.size() == 2 && layout->placement_list.size() > 1) | 55 if (list.size() == 2 && layout->placement_list.size() > 1) |
| 56 return; | 56 return; |
| 57 | 57 |
| 58 // Do not overwrite the valid data with old invalid date. | 58 // Do not overwrite the valid data with old invalid date. |
| 59 if (layouts_.count(list) && !CompareDisplayIds(list[0], list[1])) | 59 if (layouts_.count(list) && !CompareDisplayIds(list[0], list[1])) |
| 60 return; | 60 return; |
| 61 | 61 |
| 62 // Old data may not have the display_id/parent_display_id. | 62 // Old data may not have the display_id/parent_display_id. |
| 63 // Guess these values based on the saved primary_id. | 63 // Guess these values based on the saved primary_id. |
| 64 if (layout->placement_list.size() >= 1 && | 64 if (layout->placement_list.size() >= 1 && |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 placement.display_id = list[i + 1]; | 111 placement.display_id = list[i + 1]; |
| 112 placement.parent_display_id = list[i]; | 112 placement.parent_display_id = list[i]; |
| 113 layout->placement_list.push_back(placement); | 113 layout->placement_list.push_back(placement); |
| 114 } | 114 } |
| 115 layouts_[list] = std::move(layout); | 115 layouts_[list] = std::move(layout); |
| 116 auto iter = layouts_.find(list); | 116 auto iter = layouts_.find(list); |
| 117 return iter->second.get(); | 117 return iter->second.get(); |
| 118 } | 118 } |
| 119 | 119 |
| 120 } // namespace ash | 120 } // namespace ash |
| OLD | NEW |