| 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 } | 99 } |
| 100 float scale; | 100 float scale; |
| 101 }; | 101 }; |
| 102 | 102 |
| 103 gfx::Display& GetInvalidDisplay() { | 103 gfx::Display& GetInvalidDisplay() { |
| 104 static gfx::Display* invalid_display = new gfx::Display(); | 104 static gfx::Display* invalid_display = new gfx::Display(); |
| 105 return *invalid_display; | 105 return *invalid_display; |
| 106 } | 106 } |
| 107 | 107 |
| 108 void MaybeInitInternalDisplay(int64 id) { | 108 void MaybeInitInternalDisplay(int64 id) { |
| 109 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 109 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 110 if (command_line->HasSwitch(switches::kAshUseFirstDisplayAsInternal)) | 110 if (command_line->HasSwitch(switches::kAshUseFirstDisplayAsInternal)) |
| 111 gfx::Display::SetInternalDisplayId(id); | 111 gfx::Display::SetInternalDisplayId(id); |
| 112 } | 112 } |
| 113 | 113 |
| 114 // Scoped objects used to either create or close the non desktop window | 114 // Scoped objects used to either create or close the non desktop window |
| 115 // at specific timing. | 115 // at specific timing. |
| 116 class NonDesktopDisplayUpdater { | 116 class NonDesktopDisplayUpdater { |
| 117 public: | 117 public: |
| 118 NonDesktopDisplayUpdater(DisplayManager* manager, | 118 NonDesktopDisplayUpdater(DisplayManager* manager, |
| 119 DisplayManager::Delegate* delegate) | 119 DisplayManager::Delegate* delegate) |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 return scales[i - 1]; | 234 return scales[i - 1]; |
| 235 return scales[i]; | 235 return scales[i]; |
| 236 } | 236 } |
| 237 } | 237 } |
| 238 // Fallback to 1.0f if the |scale| wasn't in the list. | 238 // Fallback to 1.0f if the |scale| wasn't in the list. |
| 239 return 1.0f; | 239 return 1.0f; |
| 240 } | 240 } |
| 241 | 241 |
| 242 bool DisplayManager::InitFromCommandLine() { | 242 bool DisplayManager::InitFromCommandLine() { |
| 243 DisplayInfoList info_list; | 243 DisplayInfoList info_list; |
| 244 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 244 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 245 if (!command_line->HasSwitch(switches::kAshHostWindowBounds)) | 245 if (!command_line->HasSwitch(switches::kAshHostWindowBounds)) |
| 246 return false; | 246 return false; |
| 247 const string size_str = | 247 const string size_str = |
| 248 command_line->GetSwitchValueASCII(switches::kAshHostWindowBounds); | 248 command_line->GetSwitchValueASCII(switches::kAshHostWindowBounds); |
| 249 vector<string> parts; | 249 vector<string> parts; |
| 250 base::SplitString(size_str, ',', &parts); | 250 base::SplitString(size_str, ',', &parts); |
| 251 for (vector<string>::const_iterator iter = parts.begin(); | 251 for (vector<string>::const_iterator iter = parts.begin(); |
| 252 iter != parts.end(); ++iter) { | 252 iter != parts.end(); ++iter) { |
| 253 info_list.push_back(DisplayInfo::CreateFromSpec(*iter)); | 253 info_list.push_back(DisplayInfo::CreateFromSpec(*iter)); |
| 254 info_list.back().set_native(true); | 254 info_list.back().set_native(true); |
| (...skipping 1004 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1259 new_secondary_origin.Offset(-secondary_bounds.width(), offset); | 1259 new_secondary_origin.Offset(-secondary_bounds.width(), offset); |
| 1260 break; | 1260 break; |
| 1261 } | 1261 } |
| 1262 gfx::Insets insets = secondary_display->GetWorkAreaInsets(); | 1262 gfx::Insets insets = secondary_display->GetWorkAreaInsets(); |
| 1263 secondary_display->set_bounds( | 1263 secondary_display->set_bounds( |
| 1264 gfx::Rect(new_secondary_origin, secondary_bounds.size())); | 1264 gfx::Rect(new_secondary_origin, secondary_bounds.size())); |
| 1265 secondary_display->UpdateWorkAreaFromInsets(insets); | 1265 secondary_display->UpdateWorkAreaFromInsets(insets); |
| 1266 } | 1266 } |
| 1267 | 1267 |
| 1268 } // namespace ash | 1268 } // namespace ash |
| OLD | NEW |