| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <utility> | 5 #include <utility> |
| 6 | 6 |
| 7 #include "base/at_exit.h" | 7 #include "base/at_exit.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 | 84 |
| 85 void AddWindow(DemoWindow* window); | 85 void AddWindow(DemoWindow* window); |
| 86 void RemoveWindow(DemoWindow* window); | 86 void RemoveWindow(DemoWindow* window); |
| 87 | 87 |
| 88 private: | 88 private: |
| 89 void OnDisplaysAquired(const std::vector<ui::DisplaySnapshot*>& displays); | 89 void OnDisplaysAquired(const std::vector<ui::DisplaySnapshot*>& displays); |
| 90 void OnDisplayConfigured(const gfx::Rect& bounds, bool success); | 90 void OnDisplayConfigured(const gfx::Rect& bounds, bool success); |
| 91 | 91 |
| 92 // ui::NativeDisplayDelegate: | 92 // ui::NativeDisplayDelegate: |
| 93 void OnConfigurationChanged() override; | 93 void OnConfigurationChanged() override; |
| 94 void OnDisplaySnapshotsInvalidated() override; |
| 94 | 95 |
| 95 std::unique_ptr<ui::NativeDisplayDelegate> delegate_; | 96 std::unique_ptr<ui::NativeDisplayDelegate> delegate_; |
| 96 base::Closure quit_closure_; | 97 base::Closure quit_closure_; |
| 97 RendererFactory renderer_factory_; | 98 RendererFactory renderer_factory_; |
| 98 std::vector<std::unique_ptr<DemoWindow>> windows_; | 99 std::vector<std::unique_ptr<DemoWindow>> windows_; |
| 99 | 100 |
| 100 // Flags used to keep track of the current state of display configuration. | 101 // Flags used to keep track of the current state of display configuration. |
| 101 // | 102 // |
| 102 // True if configuring the displays. In this case a new display configuration | 103 // True if configuring the displays. In this case a new display configuration |
| 103 // isn't started. | 104 // isn't started. |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 should_configure_ = true; | 276 should_configure_ = true; |
| 276 return; | 277 return; |
| 277 } | 278 } |
| 278 | 279 |
| 279 is_configuring_ = true; | 280 is_configuring_ = true; |
| 280 delegate_->GrabServer(); | 281 delegate_->GrabServer(); |
| 281 delegate_->GetDisplays( | 282 delegate_->GetDisplays( |
| 282 base::Bind(&WindowManager::OnDisplaysAquired, base::Unretained(this))); | 283 base::Bind(&WindowManager::OnDisplaysAquired, base::Unretained(this))); |
| 283 } | 284 } |
| 284 | 285 |
| 286 void WindowManager::OnDisplaySnapshotsInvalidated() {} |
| 287 |
| 285 void WindowManager::OnDisplaysAquired( | 288 void WindowManager::OnDisplaysAquired( |
| 286 const std::vector<ui::DisplaySnapshot*>& displays) { | 289 const std::vector<ui::DisplaySnapshot*>& displays) { |
| 287 windows_.clear(); | 290 windows_.clear(); |
| 288 | 291 |
| 289 gfx::Point origin; | 292 gfx::Point origin; |
| 290 for (auto display : displays) { | 293 for (auto display : displays) { |
| 291 if (!display->native_mode()) { | 294 if (!display->native_mode()) { |
| 292 LOG(ERROR) << "Display " << display->display_id() | 295 LOG(ERROR) << "Display " << display->display_id() |
| 293 << " doesn't have a native mode"; | 296 << " doesn't have a native mode"; |
| 294 continue; | 297 continue; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 ->SetCurrentLayoutByName("us"); | 342 ->SetCurrentLayoutByName("us"); |
| 340 | 343 |
| 341 base::RunLoop run_loop; | 344 base::RunLoop run_loop; |
| 342 | 345 |
| 343 WindowManager window_manager(run_loop.QuitClosure()); | 346 WindowManager window_manager(run_loop.QuitClosure()); |
| 344 | 347 |
| 345 run_loop.Run(); | 348 run_loop.Run(); |
| 346 | 349 |
| 347 return 0; | 350 return 0; |
| 348 } | 351 } |
| OLD | NEW |