| 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 | 68 |
| 69 private: | 69 private: |
| 70 RendererType type_ = SOFTWARE; | 70 RendererType type_ = SOFTWARE; |
| 71 | 71 |
| 72 // Helper for applications that do GL on main thread. | 72 // Helper for applications that do GL on main thread. |
| 73 ui::OzoneGpuTestHelper gpu_helper_; | 73 ui::OzoneGpuTestHelper gpu_helper_; |
| 74 | 74 |
| 75 DISALLOW_COPY_AND_ASSIGN(RendererFactory); | 75 DISALLOW_COPY_AND_ASSIGN(RendererFactory); |
| 76 }; | 76 }; |
| 77 | 77 |
| 78 class WindowManager : public ui::NativeDisplayObserver { | 78 class WindowManager : public display::NativeDisplayObserver { |
| 79 public: | 79 public: |
| 80 WindowManager(const base::Closure& quit_closure); | 80 WindowManager(const base::Closure& quit_closure); |
| 81 ~WindowManager() override; | 81 ~WindowManager() override; |
| 82 | 82 |
| 83 void Quit(); | 83 void Quit(); |
| 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( |
| 90 const std::vector<display::DisplaySnapshot*>& displays); |
| 90 void OnDisplayConfigured(const gfx::Rect& bounds, bool success); | 91 void OnDisplayConfigured(const gfx::Rect& bounds, bool success); |
| 91 | 92 |
| 92 // ui::NativeDisplayDelegate: | 93 // display::NativeDisplayDelegate: |
| 93 void OnConfigurationChanged() override; | 94 void OnConfigurationChanged() override; |
| 94 void OnDisplaySnapshotsInvalidated() override; | 95 void OnDisplaySnapshotsInvalidated() override; |
| 95 | 96 |
| 96 std::unique_ptr<ui::NativeDisplayDelegate> delegate_; | 97 std::unique_ptr<display::NativeDisplayDelegate> delegate_; |
| 97 base::Closure quit_closure_; | 98 base::Closure quit_closure_; |
| 98 RendererFactory renderer_factory_; | 99 RendererFactory renderer_factory_; |
| 99 std::vector<std::unique_ptr<DemoWindow>> windows_; | 100 std::vector<std::unique_ptr<DemoWindow>> windows_; |
| 100 | 101 |
| 101 // Flags used to keep track of the current state of display configuration. | 102 // Flags used to keep track of the current state of display configuration. |
| 102 // | 103 // |
| 103 // True if configuring the displays. In this case a new display configuration | 104 // True if configuring the displays. In this case a new display configuration |
| 104 // isn't started. | 105 // isn't started. |
| 105 bool is_configuring_ = false; | 106 bool is_configuring_ = false; |
| 106 | 107 |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 | 280 |
| 280 is_configuring_ = true; | 281 is_configuring_ = true; |
| 281 delegate_->GrabServer(); | 282 delegate_->GrabServer(); |
| 282 delegate_->GetDisplays( | 283 delegate_->GetDisplays( |
| 283 base::Bind(&WindowManager::OnDisplaysAquired, base::Unretained(this))); | 284 base::Bind(&WindowManager::OnDisplaysAquired, base::Unretained(this))); |
| 284 } | 285 } |
| 285 | 286 |
| 286 void WindowManager::OnDisplaySnapshotsInvalidated() {} | 287 void WindowManager::OnDisplaySnapshotsInvalidated() {} |
| 287 | 288 |
| 288 void WindowManager::OnDisplaysAquired( | 289 void WindowManager::OnDisplaysAquired( |
| 289 const std::vector<ui::DisplaySnapshot*>& displays) { | 290 const std::vector<display::DisplaySnapshot*>& displays) { |
| 290 windows_.clear(); | 291 windows_.clear(); |
| 291 | 292 |
| 292 gfx::Point origin; | 293 gfx::Point origin; |
| 293 for (auto display : displays) { | 294 for (auto display : displays) { |
| 294 if (!display->native_mode()) { | 295 if (!display->native_mode()) { |
| 295 LOG(ERROR) << "Display " << display->display_id() | 296 LOG(ERROR) << "Display " << display->display_id() |
| 296 << " doesn't have a native mode"; | 297 << " doesn't have a native mode"; |
| 297 continue; | 298 continue; |
| 298 } | 299 } |
| 299 | 300 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 ->SetCurrentLayoutByName("us"); | 343 ->SetCurrentLayoutByName("us"); |
| 343 | 344 |
| 344 base::RunLoop run_loop; | 345 base::RunLoop run_loop; |
| 345 | 346 |
| 346 WindowManager window_manager(run_loop.QuitClosure()); | 347 WindowManager window_manager(run_loop.QuitClosure()); |
| 347 | 348 |
| 348 run_loop.Run(); | 349 run_loop.Run(); |
| 349 | 350 |
| 350 return 0; | 351 return 0; |
| 351 } | 352 } |
| OLD | NEW |