OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_DISPLAY_ROTATION_DEFAULT_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_DISPLAY_ROTATION_DEFAULT_HANDLER_H_ |
6 #define CHROME_BROWSER_CHROMEOS_POLICY_DISPLAY_ROTATION_DEFAULT_HANDLER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_POLICY_DISPLAY_ROTATION_DEFAULT_HANDLER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 #include <set> | 11 #include <set> |
12 | 12 |
13 #include "ash/display/window_tree_host_manager.h" | 13 #include "ash/display/window_tree_host_manager.h" |
14 #include "ash/shell_observer.h" | 14 #include "ash/shell_observer.h" |
15 #include "base/macros.h" | 15 #include "base/macros.h" |
16 #include "chrome/browser/chromeos/settings/cros_settings.h" | 16 #include "chrome/browser/chromeos/settings/cros_settings.h" |
17 #include "ui/gfx/display.h" | 17 #include "ui/display/display.h" |
18 | 18 |
19 namespace policy { | 19 namespace policy { |
20 | 20 |
21 // Enforces the device policy DisplayRotationDefault. | 21 // Enforces the device policy DisplayRotationDefault. |
22 // This class is created in ChromeShellDelegate::PreInit() and registers | 22 // This class is created in ChromeShellDelegate::PreInit() and registers |
23 // itself with WindowTreeHostManager as Observer for display changes, and | 23 // itself with WindowTreeHostManager as Observer for display changes, and |
24 // with CrosSettings as Observer for setting changes. Whenever there is a change | 24 // with CrosSettings as Observer for setting changes. Whenever there is a change |
25 // in the display configuration, any new display with an id that is not already | 25 // in the display configuration, any new display with an id that is not already |
26 // in rotated_displays_ will be rotated according to the policy. When there is a | 26 // in rotated_displays_ will be rotated according to the policy. When there is a |
27 // change to the CrosSettings, the new policy is applied to all connected | 27 // change to the CrosSettings, the new policy is applied to all connected |
(...skipping 21 matching lines...) Expand all Loading... |
49 // Applies the policy to all connected displays as necessary. | 49 // Applies the policy to all connected displays as necessary. |
50 void RotateDisplays(); | 50 void RotateDisplays(); |
51 | 51 |
52 // Reads |chromeos::kDisplayRotationDefault| from CrosSettings and stores | 52 // Reads |chromeos::kDisplayRotationDefault| from CrosSettings and stores |
53 // its value, and whether it has a value, in member variables | 53 // its value, and whether it has a value, in member variables |
54 // |display_rotation_default_| and |policy_enabled_|. Returns true if the | 54 // |display_rotation_default_| and |policy_enabled_|. Returns true if the |
55 // setting changed. | 55 // setting changed. |
56 bool UpdateFromCrosSettings(); | 56 bool UpdateFromCrosSettings(); |
57 | 57 |
58 bool policy_enabled_ = false; | 58 bool policy_enabled_ = false; |
59 gfx::Display::Rotation display_rotation_default_ = gfx::Display::ROTATE_0; | 59 display::Display::Rotation display_rotation_default_ = |
| 60 display::Display::ROTATE_0; |
60 std::set<int64_t> rotated_displays_; | 61 std::set<int64_t> rotated_displays_; |
61 bool rotation_in_progress_ = false; | 62 bool rotation_in_progress_ = false; |
62 | 63 |
63 std::unique_ptr<chromeos::CrosSettings::ObserverSubscription> | 64 std::unique_ptr<chromeos::CrosSettings::ObserverSubscription> |
64 settings_observer_; | 65 settings_observer_; |
65 | 66 |
66 DISALLOW_COPY_AND_ASSIGN(DisplayRotationDefaultHandler); | 67 DISALLOW_COPY_AND_ASSIGN(DisplayRotationDefaultHandler); |
67 }; | 68 }; |
68 | 69 |
69 } // namespace policy | 70 } // namespace policy |
70 | 71 |
71 #endif // CHROME_BROWSER_CHROMEOS_POLICY_DISPLAY_ROTATION_DEFAULT_HANDLER_H_ | 72 #endif // CHROME_BROWSER_CHROMEOS_POLICY_DISPLAY_ROTATION_DEFAULT_HANDLER_H_ |
OLD | NEW |