| 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_DISPLAY_MANAGER_H_ | 5 #ifndef ASH_DISPLAY_DISPLAY_MANAGER_H_ |
| 6 #define ASH_DISPLAY_DISPLAY_MANAGER_H_ | 6 #define ASH_DISPLAY_DISPLAY_MANAGER_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| 11 #include <string> | 11 #include <string> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "ash/ash_export.h" | 14 #include "ash/ash_export.h" |
| 15 #include "ash/display/display_info.h" | 15 #include "ash/display/display_info.h" |
| 16 #include "ash/display/display_layout.h" | |
| 17 #include "base/compiler_specific.h" | 16 #include "base/compiler_specific.h" |
| 18 #include "base/gtest_prod_util.h" | 17 #include "base/gtest_prod_util.h" |
| 19 #include "base/macros.h" | 18 #include "base/macros.h" |
| 20 #include "base/memory/scoped_ptr.h" | 19 #include "base/memory/scoped_ptr.h" |
| 21 #include "base/memory/weak_ptr.h" | 20 #include "base/memory/weak_ptr.h" |
| 21 #include "ui/display/manager/display_layout.h" |
| 22 #include "ui/gfx/display.h" | 22 #include "ui/gfx/display.h" |
| 23 | 23 |
| 24 #if defined(OS_CHROMEOS) | 24 #if defined(OS_CHROMEOS) |
| 25 #include "ui/display/chromeos/display_configurator.h" | 25 #include "ui/display/chromeos/display_configurator.h" |
| 26 #endif | 26 #endif |
| 27 | 27 |
| 28 namespace aura { | 28 namespace aura { |
| 29 class Window; | 29 class Window; |
| 30 } | 30 } |
| 31 | 31 |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 bool InitFromCommandLine(); | 124 bool InitFromCommandLine(); |
| 125 | 125 |
| 126 // Initialize default display. | 126 // Initialize default display. |
| 127 void InitDefaultDisplay(); | 127 void InitDefaultDisplay(); |
| 128 | 128 |
| 129 // Initializes font related params that depends on display | 129 // Initializes font related params that depends on display |
| 130 // configuration. | 130 // configuration. |
| 131 void RefreshFontParams(); | 131 void RefreshFontParams(); |
| 132 | 132 |
| 133 // Returns the display layout used for current displays. | 133 // Returns the display layout used for current displays. |
| 134 const DisplayLayout& GetCurrentDisplayLayout() const; | 134 const display::DisplayLayout& GetCurrentDisplayLayout() const; |
| 135 | 135 |
| 136 // Returns the current display list. | 136 // Returns the current display list. |
| 137 DisplayIdList GetCurrentDisplayIdList() const; | 137 display::DisplayIdList GetCurrentDisplayIdList() const; |
| 138 | 138 |
| 139 // Sets the layout for the current display pair. The |layout| specifies | 139 // Sets the layout for the current display pair. The |layout| specifies |
| 140 // the locaion of the displays relative to their parents. | 140 // the locaion of the displays relative to their parents. |
| 141 void SetLayoutForCurrentDisplays(scoped_ptr<DisplayLayout> layout); | 141 void SetLayoutForCurrentDisplays(scoped_ptr<display::DisplayLayout> layout); |
| 142 | 142 |
| 143 // Returns display for given |id|; | 143 // Returns display for given |id|; |
| 144 const gfx::Display& GetDisplayForId(int64_t id) const; | 144 const gfx::Display& GetDisplayForId(int64_t id) const; |
| 145 | 145 |
| 146 // Finds the display that contains |point| in screeen coordinates. | 146 // Finds the display that contains |point| in screeen coordinates. |
| 147 // Returns invalid display if there is no display that can satisfy | 147 // Returns invalid display if there is no display that can satisfy |
| 148 // the condition. | 148 // the condition. |
| 149 const gfx::Display& FindDisplayContainingPoint( | 149 const gfx::Display& FindDisplayContainingPoint( |
| 150 const gfx::Point& point_in_screen) const; | 150 const gfx::Point& point_in_screen) const; |
| 151 | 151 |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 // Returns the display at |index|. The display at 0 is | 230 // Returns the display at |index|. The display at 0 is |
| 231 // no longer considered "primary". | 231 // no longer considered "primary". |
| 232 const gfx::Display& GetDisplayAt(size_t index) const; | 232 const gfx::Display& GetDisplayAt(size_t index) const; |
| 233 | 233 |
| 234 const gfx::Display& GetPrimaryDisplayCandidate() const; | 234 const gfx::Display& GetPrimaryDisplayCandidate() const; |
| 235 | 235 |
| 236 // Returns the logical number of displays. This returns 1 | 236 // Returns the logical number of displays. This returns 1 |
| 237 // when displays are mirrored. | 237 // when displays are mirrored. |
| 238 size_t GetNumDisplays() const; | 238 size_t GetNumDisplays() const; |
| 239 | 239 |
| 240 const DisplayList& active_display_list() const { | 240 const display::DisplayList& active_display_list() const { |
| 241 return active_display_list_; | 241 return active_display_list_; |
| 242 } | 242 } |
| 243 | 243 |
| 244 // Returns true if the display specified by |display_id| is currently | 244 // Returns true if the display specified by |display_id| is currently |
| 245 // connected and active. (mirroring display isn't active, for example). | 245 // connected and active. (mirroring display isn't active, for example). |
| 246 bool IsActiveDisplayId(int64_t display_id) const; | 246 bool IsActiveDisplayId(int64_t display_id) const; |
| 247 | 247 |
| 248 // Returns the number of connected displays. This returns 2 | 248 // Returns the number of connected displays. This returns 2 |
| 249 // when displays are mirrored. | 249 // when displays are mirrored. |
| 250 size_t num_connected_displays() const { return num_connected_displays_; } | 250 size_t num_connected_displays() const { return num_connected_displays_; } |
| 251 | 251 |
| 252 // Returns the mirroring status. | 252 // Returns the mirroring status. |
| 253 bool IsInMirrorMode() const; | 253 bool IsInMirrorMode() const; |
| 254 int64_t mirroring_display_id() const { return mirroring_display_id_; } | 254 int64_t mirroring_display_id() const { return mirroring_display_id_; } |
| 255 const DisplayList& software_mirroring_display_list() const { | 255 const display::DisplayList& software_mirroring_display_list() const { |
| 256 return software_mirroring_display_list_; | 256 return software_mirroring_display_list_; |
| 257 } | 257 } |
| 258 | 258 |
| 259 // Sets/gets if the unified desktop feature is enabled. | 259 // Sets/gets if the unified desktop feature is enabled. |
| 260 void SetUnifiedDesktopEnabled(bool enabled); | 260 void SetUnifiedDesktopEnabled(bool enabled); |
| 261 bool unified_desktop_enabled() const { return unified_desktop_enabled_; } | 261 bool unified_desktop_enabled() const { return unified_desktop_enabled_; } |
| 262 | 262 |
| 263 // Returns true if it's in unified desktop mode. | 263 // Returns true if it's in unified desktop mode. |
| 264 bool IsInUnifiedMode() const; | 264 bool IsInUnifiedMode() const; |
| 265 | 265 |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 int64_t display_id, | 382 int64_t display_id, |
| 383 const gfx::Point& origin, | 383 const gfx::Point& origin, |
| 384 float scale); | 384 float scale); |
| 385 | 385 |
| 386 // Updates the bounds of all non-primary displays in |display_list| and | 386 // Updates the bounds of all non-primary displays in |display_list| and |
| 387 // append the indices of displays updated to |updated_indices|. | 387 // append the indices of displays updated to |updated_indices|. |
| 388 // When the size of |display_list| equals 2, the bounds are updated using | 388 // When the size of |display_list| equals 2, the bounds are updated using |
| 389 // the layout registered for the display pair. For more than 2 displays, | 389 // the layout registered for the display pair. For more than 2 displays, |
| 390 // the bounds are updated using horizontal layout. | 390 // the bounds are updated using horizontal layout. |
| 391 void UpdateNonPrimaryDisplayBoundsForLayout( | 391 void UpdateNonPrimaryDisplayBoundsForLayout( |
| 392 DisplayList* display_list, | 392 display::DisplayList* display_list, |
| 393 std::vector<size_t>* updated_indices); | 393 std::vector<size_t>* updated_indices); |
| 394 | 394 |
| 395 void CreateMirrorWindowIfAny(); | 395 void CreateMirrorWindowIfAny(); |
| 396 | 396 |
| 397 void RunPendingTasksForTest(); | 397 void RunPendingTasksForTest(); |
| 398 | 398 |
| 399 // Applies the |layout| and updates the bounds of displays in |display_list|. | 399 // Applies the |layout| and updates the bounds of displays in |display_list|. |
| 400 // |updated_ids| contains the ids for displays whose bounds have changed. | 400 // |updated_ids| contains the ids for displays whose bounds have changed. |
| 401 void ApplyDisplayLayout(const DisplayLayout& layout, | 401 void ApplyDisplayLayout(const display::DisplayLayout& layout, |
| 402 DisplayList* display_list, | 402 display::DisplayList* display_list, |
| 403 std::vector<int64_t>* updated_ids); | 403 std::vector<int64_t>* updated_ids); |
| 404 | 404 |
| 405 // Apply the display placement to the display layout. | 405 // Apply the display placement to the display layout. |
| 406 // Returns true if the display bounds has been updated. | 406 // Returns true if the display bounds has been updated. |
| 407 bool ApplyDisplayPlacement(const DisplayPlacement& placement, | 407 bool ApplyDisplayPlacement(const display::DisplayPlacement& placement, |
| 408 DisplayList* display_list); | 408 display::DisplayList* display_list); |
| 409 | 409 |
| 410 Delegate* delegate_; // not owned. | 410 Delegate* delegate_; // not owned. |
| 411 | 411 |
| 412 scoped_ptr<ScreenAsh> screen_; | 412 scoped_ptr<ScreenAsh> screen_; |
| 413 | 413 |
| 414 scoped_ptr<DisplayLayoutStore> layout_store_; | 414 scoped_ptr<DisplayLayoutStore> layout_store_; |
| 415 | 415 |
| 416 int64_t first_display_id_; | 416 int64_t first_display_id_; |
| 417 | 417 |
| 418 // List of current active displays. | 418 // List of current active displays. |
| 419 DisplayList active_display_list_; | 419 display::DisplayList active_display_list_; |
| 420 | 420 |
| 421 int num_connected_displays_; | 421 int num_connected_displays_; |
| 422 | 422 |
| 423 bool force_bounds_changed_; | 423 bool force_bounds_changed_; |
| 424 | 424 |
| 425 // The mapping from the display ID to its internal data. | 425 // The mapping from the display ID to its internal data. |
| 426 std::map<int64_t, DisplayInfo> display_info_; | 426 std::map<int64_t, DisplayInfo> display_info_; |
| 427 | 427 |
| 428 // Selected display modes for displays. Key is the displays' ID. | 428 // Selected display modes for displays. Key is the displays' ID. |
| 429 std::map<int64_t, DisplayMode> display_modes_; | 429 std::map<int64_t, DisplayMode> display_modes_; |
| 430 | 430 |
| 431 // When set to true, the host window's resize event updates | 431 // When set to true, the host window's resize event updates |
| 432 // the display's size. This is set to true when running on | 432 // the display's size. This is set to true when running on |
| 433 // desktop environment (for debugging) so that resizing the host | 433 // desktop environment (for debugging) so that resizing the host |
| 434 // window will update the display properly. This is set to false | 434 // window will update the display properly. This is set to false |
| 435 // on device as well as during the unit tests. | 435 // on device as well as during the unit tests. |
| 436 bool change_display_upon_host_resize_; | 436 bool change_display_upon_host_resize_; |
| 437 | 437 |
| 438 MultiDisplayMode multi_display_mode_; | 438 MultiDisplayMode multi_display_mode_; |
| 439 MultiDisplayMode current_default_multi_display_mode_; | 439 MultiDisplayMode current_default_multi_display_mode_; |
| 440 | 440 |
| 441 int64_t mirroring_display_id_; | 441 int64_t mirroring_display_id_; |
| 442 DisplayList software_mirroring_display_list_; | 442 display::DisplayList software_mirroring_display_list_; |
| 443 | 443 |
| 444 // User preference for rotation lock of the internal display. | 444 // User preference for rotation lock of the internal display. |
| 445 bool registered_internal_display_rotation_lock_; | 445 bool registered_internal_display_rotation_lock_; |
| 446 | 446 |
| 447 // User preference for the rotation of the internal display. | 447 // User preference for the rotation of the internal display. |
| 448 gfx::Display::Rotation registered_internal_display_rotation_; | 448 gfx::Display::Rotation registered_internal_display_rotation_; |
| 449 | 449 |
| 450 bool unified_desktop_enabled_; | 450 bool unified_desktop_enabled_; |
| 451 | 451 |
| 452 base::WeakPtrFactory<DisplayManager> weak_ptr_factory_; | 452 base::WeakPtrFactory<DisplayManager> weak_ptr_factory_; |
| 453 | 453 |
| 454 DISALLOW_COPY_AND_ASSIGN(DisplayManager); | 454 DISALLOW_COPY_AND_ASSIGN(DisplayManager); |
| 455 }; | 455 }; |
| 456 | 456 |
| 457 } // namespace ash | 457 } // namespace ash |
| 458 | 458 |
| 459 #endif // ASH_DISPLAY_DISPLAY_MANAGER_H_ | 459 #endif // ASH_DISPLAY_DISPLAY_MANAGER_H_ |
| OLD | NEW |