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 1050 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1061 gfx::Display* display = FindDisplayForId(display_id); | 1061 gfx::Display* display = FindDisplayForId(display_id); |
1062 display->SetSize(display_info_[display_id].size_in_pixel()); | 1062 display->SetSize(display_info_[display_id].size_in_pixel()); |
1063 screen_ash_->NotifyMetricsChanged( | 1063 screen_ash_->NotifyMetricsChanged( |
1064 *display, gfx::DisplayObserver::DISPLAY_METRIC_BOUNDS); | 1064 *display, gfx::DisplayObserver::DISPLAY_METRIC_BOUNDS); |
1065 return true; | 1065 return true; |
1066 } | 1066 } |
1067 return false; | 1067 return false; |
1068 } | 1068 } |
1069 | 1069 |
1070 void DisplayManager::CreateMirrorWindowAsyncIfAny() { | 1070 void DisplayManager::CreateMirrorWindowAsyncIfAny() { |
1071 // Do not post a task if the software mirroring doesn't exist. | 1071 // Do not post a task if the software mirroring doesn't exist, or |
1072 if (!HasSoftwareMirroringDisplay()) | 1072 // during initialization when compositor's init task isn't posted yet. |
| 1073 // ash::Shell::Init() will call this after the compositor is initialized. |
| 1074 if (!HasSoftwareMirroringDisplay() || !delegate_) |
1073 return; | 1075 return; |
1074 base::MessageLoopForUI::current()->PostTask( | 1076 base::MessageLoopForUI::current()->PostTask( |
1075 FROM_HERE, | 1077 FROM_HERE, |
1076 base::Bind(&DisplayManager::CreateMirrorWindowIfAny, | 1078 base::Bind(&DisplayManager::CreateMirrorWindowIfAny, |
1077 weak_ptr_factory_.GetWeakPtr())); | 1079 weak_ptr_factory_.GetWeakPtr())); |
1078 } | 1080 } |
1079 | 1081 |
1080 void DisplayManager::CreateScreenForShutdown() const { | 1082 void DisplayManager::CreateScreenForShutdown() const { |
1081 bool native_is_ash = | 1083 bool native_is_ash = |
1082 gfx::Screen::GetScreenByType(gfx::SCREEN_TYPE_NATIVE) == | 1084 gfx::Screen::GetScreenByType(gfx::SCREEN_TYPE_NATIVE) == |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1264 new_secondary_origin.Offset(-secondary_bounds.width(), offset); | 1266 new_secondary_origin.Offset(-secondary_bounds.width(), offset); |
1265 break; | 1267 break; |
1266 } | 1268 } |
1267 gfx::Insets insets = secondary_display->GetWorkAreaInsets(); | 1269 gfx::Insets insets = secondary_display->GetWorkAreaInsets(); |
1268 secondary_display->set_bounds( | 1270 secondary_display->set_bounds( |
1269 gfx::Rect(new_secondary_origin, secondary_bounds.size())); | 1271 gfx::Rect(new_secondary_origin, secondary_bounds.size())); |
1270 secondary_display->UpdateWorkAreaFromInsets(insets); | 1272 secondary_display->UpdateWorkAreaFromInsets(insets); |
1271 } | 1273 } |
1272 | 1274 |
1273 } // namespace ash | 1275 } // namespace ash |
OLD | NEW |