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 |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
238 const display::Display& GetPrimaryDisplayCandidate() const; | 238 const display::Display& GetPrimaryDisplayCandidate() const; |
239 | 239 |
240 // Returns the logical number of displays. This returns 1 | 240 // Returns the logical number of displays. This returns 1 |
241 // when displays are mirrored. | 241 // when displays are mirrored. |
242 size_t GetNumDisplays() const; | 242 size_t GetNumDisplays() const; |
243 | 243 |
244 // Returns only the currently active displays. This list does not include the | 244 // Returns only the currently active displays. This list does not include the |
245 // displays that will be removed if |UpdateDisplaysWith| is currently | 245 // displays that will be removed if |UpdateDisplaysWith| is currently |
246 // executing. | 246 // executing. |
247 // See https://crbug.com/632755 | 247 // See https://crbug.com/632755 |
248 const display::DisplayList& active_only_display_list() const { | 248 const display::Displays& active_only_display_list() const { |
msw
2016/09/06 20:14:27
I can rename identifiers using the Displays type i
| |
249 return is_updating_display_list_ ? active_only_display_list_ | 249 return is_updating_display_list_ ? active_only_display_list_ |
250 : active_display_list(); | 250 : active_display_list(); |
251 } | 251 } |
252 | 252 |
253 const display::DisplayList& active_display_list() const { | 253 const display::Displays& active_display_list() const { |
254 return active_display_list_; | 254 return active_display_list_; |
255 } | 255 } |
256 | 256 |
257 // Returns true if the display specified by |display_id| is currently | 257 // Returns true if the display specified by |display_id| is currently |
258 // connected and active. (mirroring display isn't active, for example). | 258 // connected and active. (mirroring display isn't active, for example). |
259 bool IsActiveDisplayId(int64_t display_id) const; | 259 bool IsActiveDisplayId(int64_t display_id) const; |
260 | 260 |
261 // Returns the number of connected displays. This returns 2 | 261 // Returns the number of connected displays. This returns 2 |
262 // when displays are mirrored. | 262 // when displays are mirrored. |
263 size_t num_connected_displays() const { return num_connected_displays_; } | 263 size_t num_connected_displays() const { return num_connected_displays_; } |
264 | 264 |
265 // Returns the mirroring status. | 265 // Returns the mirroring status. |
266 bool IsInMirrorMode() const; | 266 bool IsInMirrorMode() const; |
267 int64_t mirroring_display_id() const { return mirroring_display_id_; } | 267 int64_t mirroring_display_id() const { return mirroring_display_id_; } |
268 const display::DisplayList& software_mirroring_display_list() const { | 268 const display::Displays& software_mirroring_display_list() const { |
269 return software_mirroring_display_list_; | 269 return software_mirroring_display_list_; |
270 } | 270 } |
271 | 271 |
272 // Sets/gets if the unified desktop feature is enabled. | 272 // Sets/gets if the unified desktop feature is enabled. |
273 void SetUnifiedDesktopEnabled(bool enabled); | 273 void SetUnifiedDesktopEnabled(bool enabled); |
274 bool unified_desktop_enabled() const { return unified_desktop_enabled_; } | 274 bool unified_desktop_enabled() const { return unified_desktop_enabled_; } |
275 | 275 |
276 // Returns true if it's in unified desktop mode. | 276 // Returns true if it's in unified desktop mode. |
277 bool IsInUnifiedMode() const; | 277 bool IsInUnifiedMode() const; |
278 | 278 |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
399 int64_t display_id, | 399 int64_t display_id, |
400 const gfx::Point& origin, | 400 const gfx::Point& origin, |
401 float scale); | 401 float scale); |
402 | 402 |
403 // Updates the bounds of all non-primary displays in |display_list| and | 403 // Updates the bounds of all non-primary displays in |display_list| and |
404 // append the indices of displays updated to |updated_indices|. | 404 // append the indices of displays updated to |updated_indices|. |
405 // When the size of |display_list| equals 2, the bounds are updated using | 405 // When the size of |display_list| equals 2, the bounds are updated using |
406 // the layout registered for the display pair. For more than 2 displays, | 406 // the layout registered for the display pair. For more than 2 displays, |
407 // the bounds are updated using horizontal layout. | 407 // the bounds are updated using horizontal layout. |
408 void UpdateNonPrimaryDisplayBoundsForLayout( | 408 void UpdateNonPrimaryDisplayBoundsForLayout( |
409 display::DisplayList* display_list, | 409 display::Displays* display_list, |
410 std::vector<size_t>* updated_indices); | 410 std::vector<size_t>* updated_indices); |
411 | 411 |
412 void CreateMirrorWindowIfAny(); | 412 void CreateMirrorWindowIfAny(); |
413 | 413 |
414 void RunPendingTasksForTest(); | 414 void RunPendingTasksForTest(); |
415 | 415 |
416 // Applies the |layout| and updates the bounds of displays in |display_list|. | 416 // Applies the |layout| and updates the bounds of displays in |display_list|. |
417 // |updated_ids| contains the ids for displays whose bounds have changed. | 417 // |updated_ids| contains the ids for displays whose bounds have changed. |
418 void ApplyDisplayLayout(const display::DisplayLayout& layout, | 418 void ApplyDisplayLayout(const display::DisplayLayout& layout, |
419 display::DisplayList* display_list, | 419 display::Displays* display_list, |
420 std::vector<int64_t>* updated_ids); | 420 std::vector<int64_t>* updated_ids); |
421 | 421 |
422 Delegate* delegate_; // not owned. | 422 Delegate* delegate_; // not owned. |
423 | 423 |
424 std::unique_ptr<ScreenAsh> screen_; | 424 std::unique_ptr<ScreenAsh> screen_; |
425 | 425 |
426 std::unique_ptr<display::DisplayLayoutStore> layout_store_; | 426 std::unique_ptr<display::DisplayLayoutStore> layout_store_; |
427 | 427 |
428 int64_t first_display_id_; | 428 int64_t first_display_id_; |
429 | 429 |
430 // List of current active displays. | 430 // List of current active displays. |
431 display::DisplayList active_display_list_; | 431 display::Displays active_display_list_; |
432 // This list does not include the displays that will be removed if | 432 // This list does not include the displays that will be removed if |
433 // |UpdateDisplaysWith| is under execution. | 433 // |UpdateDisplaysWith| is under execution. |
434 // See https://crbug.com/632755 | 434 // See https://crbug.com/632755 |
435 display::DisplayList active_only_display_list_; | 435 display::Displays active_only_display_list_; |
436 | 436 |
437 // True if active_display_list is being modified and has displays that are not | 437 // True if active_display_list is being modified and has displays that are not |
438 // presently active. | 438 // presently active. |
439 // See https://crbug.com/632755 | 439 // See https://crbug.com/632755 |
440 bool is_updating_display_list_; | 440 bool is_updating_display_list_; |
441 | 441 |
442 int num_connected_displays_; | 442 int num_connected_displays_; |
443 | 443 |
444 bool force_bounds_changed_; | 444 bool force_bounds_changed_; |
445 | 445 |
446 // The mapping from the display ID to its internal data. | 446 // The mapping from the display ID to its internal data. |
447 std::map<int64_t, display::ManagedDisplayInfo> display_info_; | 447 std::map<int64_t, display::ManagedDisplayInfo> display_info_; |
448 | 448 |
449 // Selected display modes for displays. Key is the displays' ID. | 449 // Selected display modes for displays. Key is the displays' ID. |
450 std::map<int64_t, scoped_refptr<display::ManagedDisplayMode>> display_modes_; | 450 std::map<int64_t, scoped_refptr<display::ManagedDisplayMode>> display_modes_; |
451 | 451 |
452 // When set to true, the host window's resize event updates | 452 // When set to true, the host window's resize event updates |
453 // the display's size. This is set to true when running on | 453 // the display's size. This is set to true when running on |
454 // desktop environment (for debugging) so that resizing the host | 454 // desktop environment (for debugging) so that resizing the host |
455 // window will update the display properly. This is set to false | 455 // window will update the display properly. This is set to false |
456 // on device as well as during the unit tests. | 456 // on device as well as during the unit tests. |
457 bool change_display_upon_host_resize_; | 457 bool change_display_upon_host_resize_; |
458 | 458 |
459 MultiDisplayMode multi_display_mode_; | 459 MultiDisplayMode multi_display_mode_; |
460 MultiDisplayMode current_default_multi_display_mode_; | 460 MultiDisplayMode current_default_multi_display_mode_; |
461 | 461 |
462 int64_t mirroring_display_id_; | 462 int64_t mirroring_display_id_; |
463 display::DisplayList software_mirroring_display_list_; | 463 display::Displays software_mirroring_display_list_; |
464 | 464 |
465 // User preference for rotation lock of the internal display. | 465 // User preference for rotation lock of the internal display. |
466 bool registered_internal_display_rotation_lock_; | 466 bool registered_internal_display_rotation_lock_; |
467 | 467 |
468 // User preference for the rotation of the internal display. | 468 // User preference for the rotation of the internal display. |
469 display::Display::Rotation registered_internal_display_rotation_; | 469 display::Display::Rotation registered_internal_display_rotation_; |
470 | 470 |
471 bool unified_desktop_enabled_; | 471 bool unified_desktop_enabled_; |
472 | 472 |
473 base::WeakPtrFactory<DisplayManager> weak_ptr_factory_; | 473 base::WeakPtrFactory<DisplayManager> weak_ptr_factory_; |
474 | 474 |
475 DISALLOW_COPY_AND_ASSIGN(DisplayManager); | 475 DISALLOW_COPY_AND_ASSIGN(DisplayManager); |
476 }; | 476 }; |
477 | 477 |
478 } // namespace ash | 478 } // namespace ash |
479 | 479 |
480 #endif // ASH_DISPLAY_DISPLAY_MANAGER_H_ | 480 #endif // ASH_DISPLAY_DISPLAY_MANAGER_H_ |
OLD | NEW |