OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef SERVICES_NATIVE_VIEWPORT_DISPLAY_MANAGER_H_ |
| 6 #define SERVICES_NATIVE_VIEWPORT_DISPLAY_MANAGER_H_ |
| 7 |
| 8 #include <vector> |
| 9 #include "base/memory/weak_ptr.h" |
| 10 #include "ui/display/types/native_display_delegate.h" |
| 11 #include "ui/display/types/native_display_observer.h" |
| 12 #include "ui/gfx/geometry/rect.h" |
| 13 |
| 14 namespace native_viewport { |
| 15 |
| 16 class DisplayManager : public ui::NativeDisplayObserver { |
| 17 public: |
| 18 DisplayManager(); |
| 19 ~DisplayManager() override; |
| 20 |
| 21 private: |
| 22 void OnDisplaysAcquired(const std::vector<ui::DisplaySnapshot*>& displays); |
| 23 void OnDisplayConfigured(const gfx::Rect& bounds, bool success); |
| 24 |
| 25 // ui::NativeDisplayObserver |
| 26 void OnConfigurationChanged() override; |
| 27 |
| 28 scoped_ptr<ui::NativeDisplayDelegate> delegate_; |
| 29 |
| 30 // Flags used to keep track of the current state of display configuration. |
| 31 // |
| 32 // True if configuring the displays. In this case a new display configuration |
| 33 // isn't started. |
| 34 bool is_configuring_; |
| 35 |
| 36 // If |is_configuring_| is true and another display configuration event |
| 37 // happens, the event is deferred. This is set to true and a display |
| 38 // configuration will be scheduled after the current one finishes. |
| 39 bool should_configure_; |
| 40 |
| 41 base::WeakPtrFactory<DisplayManager> weak_factory_; |
| 42 |
| 43 DISALLOW_COPY_AND_ASSIGN(DisplayManager); |
| 44 }; |
| 45 |
| 46 } // namespace native_viewport |
| 47 |
| 48 #endif |
OLD | NEW |