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 <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
245 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 245 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
246 if (!command_line->HasSwitch(switches::kAshHostWindowBounds)) | 246 if (!command_line->HasSwitch(switches::kAshHostWindowBounds)) |
247 return false; | 247 return false; |
248 const string size_str = | 248 const string size_str = |
249 command_line->GetSwitchValueASCII(switches::kAshHostWindowBounds); | 249 command_line->GetSwitchValueASCII(switches::kAshHostWindowBounds); |
250 vector<string> parts; | 250 vector<string> parts; |
251 base::SplitString(size_str, ',', &parts); | 251 base::SplitString(size_str, ',', &parts); |
252 for (vector<string>::const_iterator iter = parts.begin(); | 252 for (vector<string>::const_iterator iter = parts.begin(); |
253 iter != parts.end(); ++iter) { | 253 iter != parts.end(); ++iter) { |
254 info_list.push_back(DisplayInfo::CreateFromSpec(*iter)); | 254 info_list.push_back(DisplayInfo::CreateFromSpec(*iter)); |
255 info_list.back().set_native(true); | |
oshima
2014/09/16 08:07:02
these are to get "restore display settings" workin
| |
255 } | 256 } |
256 MaybeInitInternalDisplay(info_list[0].id()); | 257 MaybeInitInternalDisplay(info_list[0].id()); |
257 if (info_list.size() > 1 && | 258 if (info_list.size() > 1 && |
258 command_line->HasSwitch(switches::kAshEnableSoftwareMirroring)) { | 259 command_line->HasSwitch(switches::kAshEnableSoftwareMirroring)) { |
259 SetSecondDisplayMode(MIRRORING); | 260 SetSecondDisplayMode(MIRRORING); |
260 } | 261 } |
261 OnNativeDisplaysChanged(info_list); | 262 OnNativeDisplaysChanged(info_list); |
262 return true; | 263 return true; |
263 } | 264 } |
264 | 265 |
265 void DisplayManager::InitDefaultDisplay() { | 266 void DisplayManager::InitDefaultDisplay() { |
266 DisplayInfoList info_list; | 267 DisplayInfoList info_list; |
267 info_list.push_back(DisplayInfo::CreateFromSpec(std::string())); | 268 info_list.push_back(DisplayInfo::CreateFromSpec(std::string())); |
269 info_list.back().set_native(true); | |
268 MaybeInitInternalDisplay(info_list[0].id()); | 270 MaybeInitInternalDisplay(info_list[0].id()); |
269 OnNativeDisplaysChanged(info_list); | 271 OnNativeDisplaysChanged(info_list); |
270 } | 272 } |
271 | 273 |
272 void DisplayManager::InitFontParams() { | 274 void DisplayManager::InitFontParams() { |
273 #if defined(OS_CHROMEOS) | 275 #if defined(OS_CHROMEOS) |
274 if (!HasInternalDisplay()) | 276 if (!HasInternalDisplay()) |
275 return; | 277 return; |
276 const DisplayInfo& display_info = | 278 const DisplayInfo& display_info = |
277 GetDisplayInfo(gfx::Display::InternalDisplayId()); | 279 GetDisplayInfo(gfx::Display::InternalDisplayId()); |
(...skipping 981 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1259 new_secondary_origin.Offset(-secondary_bounds.width(), offset); | 1261 new_secondary_origin.Offset(-secondary_bounds.width(), offset); |
1260 break; | 1262 break; |
1261 } | 1263 } |
1262 gfx::Insets insets = secondary_display->GetWorkAreaInsets(); | 1264 gfx::Insets insets = secondary_display->GetWorkAreaInsets(); |
1263 secondary_display->set_bounds( | 1265 secondary_display->set_bounds( |
1264 gfx::Rect(new_secondary_origin, secondary_bounds.size())); | 1266 gfx::Rect(new_secondary_origin, secondary_bounds.size())); |
1265 secondary_display->UpdateWorkAreaFromInsets(insets); | 1267 secondary_display->UpdateWorkAreaFromInsets(insets); |
1266 } | 1268 } |
1267 | 1269 |
1268 } // namespace ash | 1270 } // namespace ash |
OLD | NEW |