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 #include "ash/display/window_tree_host_manager.h" | 5 #include "ash/display/window_tree_host_manager.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 #include <map> | 9 #include <map> |
10 | 10 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 #endif | 68 #endif |
69 | 69 |
70 namespace ash { | 70 namespace ash { |
71 namespace { | 71 namespace { |
72 | 72 |
73 // Primary display stored in global object as it can be | 73 // Primary display stored in global object as it can be |
74 // accessed after Shell is deleted. A separate display instance is created | 74 // accessed after Shell is deleted. A separate display instance is created |
75 // during the shutdown instead of always keeping two display instances | 75 // during the shutdown instead of always keeping two display instances |
76 // (one here and another one in display_manager) in sync, which is error prone. | 76 // (one here and another one in display_manager) in sync, which is error prone. |
77 // This is initialized in the constructor, and then in CreatePrimaryHost(). | 77 // This is initialized in the constructor, and then in CreatePrimaryHost(). |
78 int64 primary_display_id = -1; | 78 int64_t primary_display_id = -1; |
79 | 79 |
80 // Specifies how long the display change should have been disabled | 80 // Specifies how long the display change should have been disabled |
81 // after each display change operations. | 81 // after each display change operations. |
82 // |kCycleDisplayThrottleTimeoutMs| is set to be longer to avoid | 82 // |kCycleDisplayThrottleTimeoutMs| is set to be longer to avoid |
83 // changing the settings while the system is still configurating | 83 // changing the settings while the system is still configurating |
84 // displays. It will be overriden by |kAfterDisplayChangeThrottleTimeoutMs| | 84 // displays. It will be overriden by |kAfterDisplayChangeThrottleTimeoutMs| |
85 // when the display change happens, so the actual timeout is much shorter. | 85 // when the display change happens, so the actual timeout is much shorter. |
86 const int64 kAfterDisplayChangeThrottleTimeoutMs = 500; | 86 const int64_t kAfterDisplayChangeThrottleTimeoutMs = 500; |
87 const int64 kCycleDisplayThrottleTimeoutMs = 4000; | 87 const int64_t kCycleDisplayThrottleTimeoutMs = 4000; |
88 const int64 kSwapDisplayThrottleTimeoutMs = 500; | 88 const int64_t kSwapDisplayThrottleTimeoutMs = 500; |
89 | 89 |
90 #if defined(USE_OZONE) && defined(OS_CHROMEOS) | 90 #if defined(USE_OZONE) && defined(OS_CHROMEOS) |
91 // Add 20% more cursor motion on non-integrated displays. | 91 // Add 20% more cursor motion on non-integrated displays. |
92 const float kCursorMultiplierForExternalDisplays = 1.2f; | 92 const float kCursorMultiplierForExternalDisplays = 1.2f; |
93 #endif | 93 #endif |
94 | 94 |
95 DisplayManager* GetDisplayManager() { | 95 DisplayManager* GetDisplayManager() { |
96 return Shell::GetInstance()->display_manager(); | 96 return Shell::GetInstance()->display_manager(); |
97 } | 97 } |
98 | 98 |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 DISALLOW_COPY_AND_ASSIGN(FocusActivationStore); | 243 DISALLOW_COPY_AND_ASSIGN(FocusActivationStore); |
244 }; | 244 }; |
245 | 245 |
246 //////////////////////////////////////////////////////////////////////////////// | 246 //////////////////////////////////////////////////////////////////////////////// |
247 // DisplayChangeLimiter | 247 // DisplayChangeLimiter |
248 | 248 |
249 WindowTreeHostManager::DisplayChangeLimiter::DisplayChangeLimiter() | 249 WindowTreeHostManager::DisplayChangeLimiter::DisplayChangeLimiter() |
250 : throttle_timeout_(base::Time::Now()) {} | 250 : throttle_timeout_(base::Time::Now()) {} |
251 | 251 |
252 void WindowTreeHostManager::DisplayChangeLimiter::SetThrottleTimeout( | 252 void WindowTreeHostManager::DisplayChangeLimiter::SetThrottleTimeout( |
253 int64 throttle_ms) { | 253 int64_t throttle_ms) { |
254 throttle_timeout_ = | 254 throttle_timeout_ = |
255 base::Time::Now() + base::TimeDelta::FromMilliseconds(throttle_ms); | 255 base::Time::Now() + base::TimeDelta::FromMilliseconds(throttle_ms); |
256 } | 256 } |
257 | 257 |
258 bool WindowTreeHostManager::DisplayChangeLimiter::IsThrottled() const { | 258 bool WindowTreeHostManager::DisplayChangeLimiter::IsThrottled() const { |
259 return base::Time::Now() < throttle_timeout_; | 259 return base::Time::Now() < throttle_timeout_; |
260 } | 260 } |
261 | 261 |
262 //////////////////////////////////////////////////////////////////////////////// | 262 //////////////////////////////////////////////////////////////////////////////// |
263 // WindowTreeHostManager | 263 // WindowTreeHostManager |
(...skipping 26 matching lines...) Expand all Loading... |
290 | 290 |
291 // Unset the display manager's delegate here because | 291 // Unset the display manager's delegate here because |
292 // DisplayManager outlives WindowTreeHostManager. | 292 // DisplayManager outlives WindowTreeHostManager. |
293 Shell::GetInstance()->display_manager()->set_delegate(nullptr); | 293 Shell::GetInstance()->display_manager()->set_delegate(nullptr); |
294 | 294 |
295 cursor_window_controller_.reset(); | 295 cursor_window_controller_.reset(); |
296 mirror_window_controller_.reset(); | 296 mirror_window_controller_.reset(); |
297 | 297 |
298 Shell::GetScreen()->RemoveObserver(this); | 298 Shell::GetScreen()->RemoveObserver(this); |
299 | 299 |
300 int64 primary_id = Shell::GetScreen()->GetPrimaryDisplay().id(); | 300 int64_t primary_id = Shell::GetScreen()->GetPrimaryDisplay().id(); |
301 | 301 |
302 // Delete non primary root window controllers first, then | 302 // Delete non primary root window controllers first, then |
303 // delete the primary root window controller. | 303 // delete the primary root window controller. |
304 aura::Window::Windows root_windows = | 304 aura::Window::Windows root_windows = |
305 WindowTreeHostManager::GetAllRootWindows(); | 305 WindowTreeHostManager::GetAllRootWindows(); |
306 std::vector<RootWindowController*> to_delete; | 306 std::vector<RootWindowController*> to_delete; |
307 RootWindowController* primary_rwc = nullptr; | 307 RootWindowController* primary_rwc = nullptr; |
308 for (aura::Window::Windows::iterator iter = root_windows.begin(); | 308 for (aura::Window::Windows::iterator iter = root_windows.begin(); |
309 iter != root_windows.end(); ++iter) { | 309 iter != root_windows.end(); ++iter) { |
310 RootWindowController* rwc = GetRootWindowController(*iter); | 310 RootWindowController* rwc = GetRootWindowController(*iter); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 | 346 |
347 void WindowTreeHostManager::AddObserver(Observer* observer) { | 347 void WindowTreeHostManager::AddObserver(Observer* observer) { |
348 observers_.AddObserver(observer); | 348 observers_.AddObserver(observer); |
349 } | 349 } |
350 | 350 |
351 void WindowTreeHostManager::RemoveObserver(Observer* observer) { | 351 void WindowTreeHostManager::RemoveObserver(Observer* observer) { |
352 observers_.RemoveObserver(observer); | 352 observers_.RemoveObserver(observer); |
353 } | 353 } |
354 | 354 |
355 // static | 355 // static |
356 int64 WindowTreeHostManager::GetPrimaryDisplayId() { | 356 int64_t WindowTreeHostManager::GetPrimaryDisplayId() { |
357 CHECK_NE(gfx::Display::kInvalidDisplayID, primary_display_id); | 357 CHECK_NE(gfx::Display::kInvalidDisplayID, primary_display_id); |
358 return primary_display_id; | 358 return primary_display_id; |
359 } | 359 } |
360 | 360 |
361 aura::Window* WindowTreeHostManager::GetPrimaryRootWindow() { | 361 aura::Window* WindowTreeHostManager::GetPrimaryRootWindow() { |
362 return GetRootWindowForDisplayId(primary_display_id); | 362 return GetRootWindowForDisplayId(primary_display_id); |
363 } | 363 } |
364 | 364 |
365 aura::Window* WindowTreeHostManager::GetRootWindowForDisplayId(int64 id) { | 365 aura::Window* WindowTreeHostManager::GetRootWindowForDisplayId(int64_t id) { |
366 AshWindowTreeHost* host = GetAshWindowTreeHostForDisplayId(id); | 366 AshWindowTreeHost* host = GetAshWindowTreeHostForDisplayId(id); |
367 CHECK(host); | 367 CHECK(host); |
368 return GetWindow(host); | 368 return GetWindow(host); |
369 } | 369 } |
370 | 370 |
371 AshWindowTreeHost* WindowTreeHostManager::GetAshWindowTreeHostForDisplayId( | 371 AshWindowTreeHost* WindowTreeHostManager::GetAshWindowTreeHostForDisplayId( |
372 int64 display_id) { | 372 int64_t display_id) { |
373 CHECK_EQ(1u, window_tree_hosts_.count(display_id)) << "display id = " | 373 CHECK_EQ(1u, window_tree_hosts_.count(display_id)) << "display id = " |
374 << display_id; | 374 << display_id; |
375 return window_tree_hosts_[display_id]; | 375 return window_tree_hosts_[display_id]; |
376 } | 376 } |
377 | 377 |
378 void WindowTreeHostManager::CloseChildWindows() { | 378 void WindowTreeHostManager::CloseChildWindows() { |
379 for (WindowTreeHostMap::const_iterator it = window_tree_hosts_.begin(); | 379 for (WindowTreeHostMap::const_iterator it = window_tree_hosts_.begin(); |
380 it != window_tree_hosts_.end(); ++it) { | 380 it != window_tree_hosts_.end(); ++it) { |
381 aura::Window* root_window = GetWindow(it->second); | 381 aura::Window* root_window = GetWindow(it->second); |
382 RootWindowController* controller = GetRootWindowController(root_window); | 382 RootWindowController* controller = GetRootWindowController(root_window); |
(...skipping 12 matching lines...) Expand all Loading... |
395 aura::Window::Windows windows; | 395 aura::Window::Windows windows; |
396 for (WindowTreeHostMap::const_iterator it = window_tree_hosts_.begin(); | 396 for (WindowTreeHostMap::const_iterator it = window_tree_hosts_.begin(); |
397 it != window_tree_hosts_.end(); ++it) { | 397 it != window_tree_hosts_.end(); ++it) { |
398 DCHECK(it->second); | 398 DCHECK(it->second); |
399 if (GetRootWindowController(GetWindow(it->second))) | 399 if (GetRootWindowController(GetWindow(it->second))) |
400 windows.push_back(GetWindow(it->second)); | 400 windows.push_back(GetWindow(it->second)); |
401 } | 401 } |
402 return windows; | 402 return windows; |
403 } | 403 } |
404 | 404 |
405 gfx::Insets WindowTreeHostManager::GetOverscanInsets(int64 display_id) const { | 405 gfx::Insets WindowTreeHostManager::GetOverscanInsets(int64_t display_id) const { |
406 return GetDisplayManager()->GetOverscanInsets(display_id); | 406 return GetDisplayManager()->GetOverscanInsets(display_id); |
407 } | 407 } |
408 | 408 |
409 void WindowTreeHostManager::SetOverscanInsets( | 409 void WindowTreeHostManager::SetOverscanInsets( |
410 int64 display_id, | 410 int64_t display_id, |
411 const gfx::Insets& insets_in_dip) { | 411 const gfx::Insets& insets_in_dip) { |
412 GetDisplayManager()->SetOverscanInsets(display_id, insets_in_dip); | 412 GetDisplayManager()->SetOverscanInsets(display_id, insets_in_dip); |
413 } | 413 } |
414 | 414 |
415 std::vector<RootWindowController*> | 415 std::vector<RootWindowController*> |
416 WindowTreeHostManager::GetAllRootWindowControllers() { | 416 WindowTreeHostManager::GetAllRootWindowControllers() { |
417 std::vector<RootWindowController*> controllers; | 417 std::vector<RootWindowController*> controllers; |
418 for (WindowTreeHostMap::const_iterator it = window_tree_hosts_.begin(); | 418 for (WindowTreeHostMap::const_iterator it = window_tree_hosts_.begin(); |
419 it != window_tree_hosts_.end(); ++it) { | 419 it != window_tree_hosts_.end(); ++it) { |
420 RootWindowController* controller = | 420 RootWindowController* controller = |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 weak_ptr_factory_.GetWeakPtr())); | 462 weak_ptr_factory_.GetWeakPtr())); |
463 } else { | 463 } else { |
464 SetPrimaryDisplay(ScreenUtil::GetSecondaryDisplay()); | 464 SetPrimaryDisplay(ScreenUtil::GetSecondaryDisplay()); |
465 } | 465 } |
466 #else | 466 #else |
467 SetPrimaryDisplay(ScreenUtil::GetSecondaryDisplay()); | 467 SetPrimaryDisplay(ScreenUtil::GetSecondaryDisplay()); |
468 #endif | 468 #endif |
469 } | 469 } |
470 } | 470 } |
471 | 471 |
472 void WindowTreeHostManager::SetPrimaryDisplayId(int64 id) { | 472 void WindowTreeHostManager::SetPrimaryDisplayId(int64_t id) { |
473 DCHECK_NE(gfx::Display::kInvalidDisplayID, id); | 473 DCHECK_NE(gfx::Display::kInvalidDisplayID, id); |
474 if (id == gfx::Display::kInvalidDisplayID || primary_display_id == id) | 474 if (id == gfx::Display::kInvalidDisplayID || primary_display_id == id) |
475 return; | 475 return; |
476 | 476 |
477 const gfx::Display& display = GetDisplayManager()->GetDisplayForId(id); | 477 const gfx::Display& display = GetDisplayManager()->GetDisplayForId(id); |
478 if (display.is_valid()) | 478 if (display.is_valid()) |
479 SetPrimaryDisplay(display); | 479 SetPrimaryDisplay(display); |
480 } | 480 } |
481 | 481 |
482 void WindowTreeHostManager::SetPrimaryDisplay( | 482 void WindowTreeHostManager::SetPrimaryDisplay( |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
540 GetDisplayManager()->set_force_bounds_changed(false); | 540 GetDisplayManager()->set_force_bounds_changed(false); |
541 } | 541 } |
542 | 542 |
543 void WindowTreeHostManager::UpdateMouseLocationAfterDisplayChange() { | 543 void WindowTreeHostManager::UpdateMouseLocationAfterDisplayChange() { |
544 // If the mouse is currently on a display in native location, | 544 // If the mouse is currently on a display in native location, |
545 // use the same native location. Otherwise find the display closest | 545 // use the same native location. Otherwise find the display closest |
546 // to the current cursor location in screen coordinates. | 546 // to the current cursor location in screen coordinates. |
547 | 547 |
548 gfx::Point point_in_screen = Shell::GetScreen()->GetCursorScreenPoint(); | 548 gfx::Point point_in_screen = Shell::GetScreen()->GetCursorScreenPoint(); |
549 gfx::Point target_location_in_native; | 549 gfx::Point target_location_in_native; |
550 int64 closest_distance_squared = -1; | 550 int64_t closest_distance_squared = -1; |
551 DisplayManager* display_manager = GetDisplayManager(); | 551 DisplayManager* display_manager = GetDisplayManager(); |
552 | 552 |
553 aura::Window* dst_root_window = nullptr; | 553 aura::Window* dst_root_window = nullptr; |
554 for (size_t i = 0; i < display_manager->GetNumDisplays(); ++i) { | 554 for (size_t i = 0; i < display_manager->GetNumDisplays(); ++i) { |
555 const gfx::Display& display = display_manager->GetDisplayAt(i); | 555 const gfx::Display& display = display_manager->GetDisplayAt(i); |
556 const DisplayInfo display_info = | 556 const DisplayInfo display_info = |
557 display_manager->GetDisplayInfo(display.id()); | 557 display_manager->GetDisplayInfo(display.id()); |
558 aura::Window* root_window = GetRootWindowForDisplayId(display.id()); | 558 aura::Window* root_window = GetRootWindowForDisplayId(display.id()); |
559 if (display_info.bounds_in_native().Contains( | 559 if (display_info.bounds_in_native().Contains( |
560 cursor_location_in_native_coords_for_restore_)) { | 560 cursor_location_in_native_coords_for_restore_)) { |
561 dst_root_window = root_window; | 561 dst_root_window = root_window; |
562 target_location_in_native = cursor_location_in_native_coords_for_restore_; | 562 target_location_in_native = cursor_location_in_native_coords_for_restore_; |
563 break; | 563 break; |
564 } | 564 } |
565 gfx::Point center = display.bounds().CenterPoint(); | 565 gfx::Point center = display.bounds().CenterPoint(); |
566 // Use the distance squared from the center of the dislay. This is not | 566 // Use the distance squared from the center of the dislay. This is not |
567 // exactly "closest" display, but good enough to pick one | 567 // exactly "closest" display, but good enough to pick one |
568 // appropriate (and there are at most two displays). | 568 // appropriate (and there are at most two displays). |
569 // We don't care about actual distance, only relative to other displays, so | 569 // We don't care about actual distance, only relative to other displays, so |
570 // using the LengthSquared() is cheaper than Length(). | 570 // using the LengthSquared() is cheaper than Length(). |
571 | 571 |
572 int64 distance_squared = (center - point_in_screen).LengthSquared(); | 572 int64_t distance_squared = (center - point_in_screen).LengthSquared(); |
573 if (closest_distance_squared < 0 || | 573 if (closest_distance_squared < 0 || |
574 closest_distance_squared > distance_squared) { | 574 closest_distance_squared > distance_squared) { |
575 aura::Window* root_window = GetRootWindowForDisplayId(display.id()); | 575 aura::Window* root_window = GetRootWindowForDisplayId(display.id()); |
576 ::wm::ConvertPointFromScreen(root_window, ¢er); | 576 ::wm::ConvertPointFromScreen(root_window, ¢er); |
577 root_window->GetHost()->ConvertPointToNativeScreen(¢er); | 577 root_window->GetHost()->ConvertPointToNativeScreen(¢er); |
578 dst_root_window = root_window; | 578 dst_root_window = root_window; |
579 target_location_in_native = center; | 579 target_location_in_native = center; |
580 closest_distance_squared = distance_squared; | 580 closest_distance_squared = distance_squared; |
581 } | 581 } |
582 } | 582 } |
583 | 583 |
584 gfx::Point target_location_in_root = target_location_in_native; | 584 gfx::Point target_location_in_root = target_location_in_native; |
585 dst_root_window->GetHost()->ConvertPointFromNativeScreen( | 585 dst_root_window->GetHost()->ConvertPointFromNativeScreen( |
586 &target_location_in_root); | 586 &target_location_in_root); |
587 | 587 |
588 #if defined(USE_OZONE) | 588 #if defined(USE_OZONE) |
589 gfx::Point target_location_in_screen = target_location_in_root; | 589 gfx::Point target_location_in_screen = target_location_in_root; |
590 ::wm::ConvertPointToScreen(dst_root_window, &target_location_in_screen); | 590 ::wm::ConvertPointToScreen(dst_root_window, &target_location_in_screen); |
591 const gfx::Display& target_display = | 591 const gfx::Display& target_display = |
592 display_manager->FindDisplayContainingPoint(target_location_in_screen); | 592 display_manager->FindDisplayContainingPoint(target_location_in_screen); |
593 // If the original location isn't on any of new display, let ozone move | 593 // If the original location isn't on any of new display, let ozone move |
594 // the cursor. | 594 // the cursor. |
595 if (!target_display.is_valid()) | 595 if (!target_display.is_valid()) |
596 return; | 596 return; |
597 int64 target_display_id = target_display.id(); | 597 int64_t target_display_id = target_display.id(); |
598 | 598 |
599 // Do not move the cursor if the cursor's location did not change. This avoids | 599 // Do not move the cursor if the cursor's location did not change. This avoids |
600 // moving (and showing) the cursor: | 600 // moving (and showing) the cursor: |
601 // - At startup. | 601 // - At startup. |
602 // - When the device is rotated in maximized mode. | 602 // - When the device is rotated in maximized mode. |
603 // |cursor_display_id_for_restore_| is checked to ensure that the cursor is | 603 // |cursor_display_id_for_restore_| is checked to ensure that the cursor is |
604 // moved when the cursor's native position does not change but the display | 604 // moved when the cursor's native position does not change but the display |
605 // that it is on has changed. This occurs when swapping the primary display. | 605 // that it is on has changed. This occurs when swapping the primary display. |
606 if (target_location_in_native != | 606 if (target_location_in_native != |
607 cursor_location_in_native_coords_for_restore_ || | 607 cursor_location_in_native_coords_for_restore_ || |
(...skipping 15 matching lines...) Expand all Loading... |
623 } | 623 } |
624 #else | 624 #else |
625 dst_root_window->MoveCursorTo(target_location_in_root); | 625 dst_root_window->MoveCursorTo(target_location_in_root); |
626 #endif | 626 #endif |
627 } | 627 } |
628 | 628 |
629 bool WindowTreeHostManager::UpdateWorkAreaOfDisplayNearestWindow( | 629 bool WindowTreeHostManager::UpdateWorkAreaOfDisplayNearestWindow( |
630 const aura::Window* window, | 630 const aura::Window* window, |
631 const gfx::Insets& insets) { | 631 const gfx::Insets& insets) { |
632 const aura::Window* root_window = window->GetRootWindow(); | 632 const aura::Window* root_window = window->GetRootWindow(); |
633 int64 id = GetRootWindowSettings(root_window)->display_id; | 633 int64_t id = GetRootWindowSettings(root_window)->display_id; |
634 // if id is |kInvaildDisplayID|, it's being deleted. | 634 // if id is |kInvaildDisplayID|, it's being deleted. |
635 DCHECK(id != gfx::Display::kInvalidDisplayID); | 635 DCHECK(id != gfx::Display::kInvalidDisplayID); |
636 return GetDisplayManager()->UpdateWorkAreaOfDisplay(id, insets); | 636 return GetDisplayManager()->UpdateWorkAreaOfDisplay(id, insets); |
637 } | 637 } |
638 | 638 |
639 void WindowTreeHostManager::OnDisplayAdded(const gfx::Display& display) { | 639 void WindowTreeHostManager::OnDisplayAdded(const gfx::Display& display) { |
640 #if defined(OS_CHROMEOS) | 640 #if defined(OS_CHROMEOS) |
641 // If we're switching from/to offscreen WTH, we need to | 641 // If we're switching from/to offscreen WTH, we need to |
642 // create new WTH for primary display instead of reusing. | 642 // create new WTH for primary display instead of reusing. |
643 if (primary_tree_host_for_replace_ && | 643 if (primary_tree_host_for_replace_ && |
(...skipping 27 matching lines...) Expand all Loading... |
671 ash::Shell::GetInstance()->GetPrimarySystemTray(); | 671 ash::Shell::GetInstance()->GetPrimarySystemTray(); |
672 if (old_tray->GetWidget()->IsVisible()) { | 672 if (old_tray->GetWidget()->IsVisible()) { |
673 new_tray->SetVisible(true); | 673 new_tray->SetVisible(true); |
674 new_tray->GetWidget()->Show(); | 674 new_tray->GetWidget()->Show(); |
675 } | 675 } |
676 | 676 |
677 DeleteHost(to_delete); | 677 DeleteHost(to_delete); |
678 #ifndef NDEBUG | 678 #ifndef NDEBUG |
679 auto iter = std::find_if( | 679 auto iter = std::find_if( |
680 window_tree_hosts_.begin(), window_tree_hosts_.end(), | 680 window_tree_hosts_.begin(), window_tree_hosts_.end(), |
681 [to_delete](const std::pair<int64, AshWindowTreeHost*>& pair) { | 681 [to_delete](const std::pair<int64_t, AshWindowTreeHost*>& pair) { |
682 return pair.second == to_delete; | 682 return pair.second == to_delete; |
683 }); | 683 }); |
684 DCHECK(iter == window_tree_hosts_.end()); | 684 DCHECK(iter == window_tree_hosts_.end()); |
685 #endif | 685 #endif |
686 // the host has already been removed from the window_tree_host_. | 686 // the host has already been removed from the window_tree_host_. |
687 } else | 687 } else |
688 #endif | 688 #endif |
689 // TODO(oshima): It should be possible to consolidate logic for | 689 // TODO(oshima): It should be possible to consolidate logic for |
690 // unified and non unified, but I'm keeping them separated to minimize | 690 // unified and non unified, but I'm keeping them separated to minimize |
691 // the risk in M44. I'll consolidate this in M45. | 691 // the risk in M44. I'll consolidate this in M45. |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
841 | 841 |
842 DisplayManager* display_manager = GetDisplayManager(); | 842 DisplayManager* display_manager = GetDisplayManager(); |
843 DisplayLayoutStore* layout_store = display_manager->layout_store(); | 843 DisplayLayoutStore* layout_store = display_manager->layout_store(); |
844 if (display_manager->num_connected_displays() > 1) { | 844 if (display_manager->num_connected_displays() > 1) { |
845 DisplayIdPair pair = display_manager->GetCurrentDisplayIdPair(); | 845 DisplayIdPair pair = display_manager->GetCurrentDisplayIdPair(); |
846 DisplayLayout layout = layout_store->GetRegisteredDisplayLayout(pair); | 846 DisplayLayout layout = layout_store->GetRegisteredDisplayLayout(pair); |
847 layout_store->UpdateMultiDisplayState( | 847 layout_store->UpdateMultiDisplayState( |
848 pair, display_manager->IsInMirrorMode(), layout.default_unified); | 848 pair, display_manager->IsInMirrorMode(), layout.default_unified); |
849 | 849 |
850 if (Shell::GetScreen()->GetNumDisplays() > 1) { | 850 if (Shell::GetScreen()->GetNumDisplays() > 1) { |
851 int64 primary_id = layout.primary_id; | 851 int64_t primary_id = layout.primary_id; |
852 SetPrimaryDisplayId(primary_id == gfx::Display::kInvalidDisplayID | 852 SetPrimaryDisplayId(primary_id == gfx::Display::kInvalidDisplayID |
853 ? pair.first | 853 ? pair.first |
854 : primary_id); | 854 : primary_id); |
855 // Update the primary_id in case the above call is | 855 // Update the primary_id in case the above call is |
856 // ignored. Happens when a) default layout's primary id | 856 // ignored. Happens when a) default layout's primary id |
857 // doesn't exist, or b) the primary_id has already been | 857 // doesn't exist, or b) the primary_id has already been |
858 // set to the same and didn't update it. | 858 // set to the same and didn't update it. |
859 layout_store->UpdatePrimaryDisplayId( | 859 layout_store->UpdatePrimaryDisplayId( |
860 pair, Shell::GetScreen()->GetPrimaryDisplay().id()); | 860 pair, Shell::GetScreen()->GetPrimaryDisplay().id()); |
861 } | 861 } |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
927 ->display_configurator_animation() | 927 ->display_configurator_animation() |
928 ->StartFadeInAnimation(); | 928 ->StartFadeInAnimation(); |
929 #endif | 929 #endif |
930 } | 930 } |
931 | 931 |
932 void WindowTreeHostManager::SetMirrorModeAfterAnimation(bool mirror) { | 932 void WindowTreeHostManager::SetMirrorModeAfterAnimation(bool mirror) { |
933 GetDisplayManager()->SetMirrorMode(mirror); | 933 GetDisplayManager()->SetMirrorMode(mirror); |
934 } | 934 } |
935 | 935 |
936 } // namespace ash | 936 } // namespace ash |
OLD | NEW |