| 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 #ifndef ASH_DISPLAY_MULTI_DISPLAY_MANAGER_H_ | 5 #ifndef ASH_DISPLAY_MULTI_DISPLAY_MANAGER_H_ |
| 6 #define ASH_DISPLAY_MULTI_DISPLAY_MANAGER_H_ | 6 #define ASH_DISPLAY_MULTI_DISPLAY_MANAGER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 // TODO(oshima): gfx::Screen needs to return translated coordinates | 31 // TODO(oshima): gfx::Screen needs to return translated coordinates |
| 32 // if the root window is translated. crbug.com/119268. | 32 // if the root window is translated. crbug.com/119268. |
| 33 class ASH_EXPORT MultiDisplayManager : public aura::DisplayManager, | 33 class ASH_EXPORT MultiDisplayManager : public aura::DisplayManager, |
| 34 public aura::RootWindowObserver { | 34 public aura::RootWindowObserver { |
| 35 public: | 35 public: |
| 36 MultiDisplayManager(); | 36 MultiDisplayManager(); |
| 37 virtual ~MultiDisplayManager(); | 37 virtual ~MultiDisplayManager(); |
| 38 | 38 |
| 39 // Used to emulate display change when run in a desktop environment instead | 39 // Used to emulate display change when run in a desktop environment instead |
| 40 // of on a device. | 40 // of on a device. |
| 41 static void AddRemoveDisplay(); | |
| 42 static void CycleDisplay(); | 41 static void CycleDisplay(); |
| 43 static void ToggleDisplayScale(); | 42 static void ToggleDisplayScale(); |
| 44 | 43 |
| 45 // Detects the internal display's ID, and stores gfx::Display | 44 // Detects the internal display's ID, and stores gfx::Display |
| 46 // in the cache, if any. | 45 // in the cache, if any. |
| 47 void InitInternalDisplayInfo(); | 46 void InitInternalDisplayInfo(); |
| 48 | 47 |
| 49 bool UpdateWorkAreaOfDisplayNearestWindow(const aura::Window* window, | 48 bool UpdateWorkAreaOfDisplayNearestWindow(const aura::Window* window, |
| 50 const gfx::Insets& insets); | 49 const gfx::Insets& insets); |
| 51 | 50 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 74 // RootWindowObserver overrides: | 73 // RootWindowObserver overrides: |
| 75 virtual void OnRootWindowResized(const aura::RootWindow* root, | 74 virtual void OnRootWindowResized(const aura::RootWindow* root, |
| 76 const gfx::Size& new_size) OVERRIDE; | 75 const gfx::Size& new_size) OVERRIDE; |
| 77 | 76 |
| 78 private: | 77 private: |
| 79 FRIEND_TEST_ALL_PREFIXES(ExtendedDesktopTest, ConvertPoint); | 78 FRIEND_TEST_ALL_PREFIXES(ExtendedDesktopTest, ConvertPoint); |
| 80 FRIEND_TEST_ALL_PREFIXES(MultiDisplayManagerTest, TestNativeDisplaysChanged); | 79 FRIEND_TEST_ALL_PREFIXES(MultiDisplayManagerTest, TestNativeDisplaysChanged); |
| 81 typedef std::vector<gfx::Display> Displays; | 80 typedef std::vector<gfx::Display> Displays; |
| 82 | 81 |
| 83 void Init(); | 82 void Init(); |
| 84 void AddRemoveDisplayImpl(); | |
| 85 void CycleDisplayImpl(); | 83 void CycleDisplayImpl(); |
| 86 void ScaleDisplayImpl(); | 84 void ScaleDisplayImpl(); |
| 87 gfx::Display& FindDisplayForRootWindow(const aura::RootWindow* root); | 85 gfx::Display& FindDisplayForRootWindow(const aura::RootWindow* root); |
| 88 | 86 |
| 89 // Refer to |aura::DisplayManager::CreateDisplayFromSpec| API for | 87 // Refer to |aura::DisplayManager::CreateDisplayFromSpec| API for |
| 90 // the format of |spec|. | 88 // the format of |spec|. |
| 91 void AddDisplayFromSpec(const std::string& spec); | 89 void AddDisplayFromSpec(const std::string& spec); |
| 92 | 90 |
| 93 void SetInternalDisplayIdForTest(int64 id); | 91 void SetInternalDisplayIdForTest(int64 id); |
| 94 | 92 |
| 95 Displays displays_; | 93 Displays displays_; |
| 96 | 94 |
| 97 int64 internal_display_id_; | 95 int64 internal_display_id_; |
| 98 | 96 |
| 99 // An internal display cache used when the internal display is disconnectd. | 97 // An internal display cache used when the internal display is disconnectd. |
| 100 scoped_ptr<gfx::Display> internal_display_; | 98 scoped_ptr<gfx::Display> internal_display_; |
| 101 | 99 |
| 102 DISALLOW_COPY_AND_ASSIGN(MultiDisplayManager); | 100 DISALLOW_COPY_AND_ASSIGN(MultiDisplayManager); |
| 103 }; | 101 }; |
| 104 | 102 |
| 105 extern const aura::WindowProperty<int64>* const kDisplayIdKey; | 103 extern const aura::WindowProperty<int64>* const kDisplayIdKey; |
| 106 | 104 |
| 107 } // namespace internal | 105 } // namespace internal |
| 108 } // namespace ash | 106 } // namespace ash |
| 109 | 107 |
| 110 #endif // ASH_DISPLAY_MULTI_DISPLAY_MANAGER_H_ | 108 #endif // ASH_DISPLAY_MULTI_DISPLAY_MANAGER_H_ |
| OLD | NEW |