Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(559)

Side by Side Diff: ash/display/window_tree_host_manager.cc

Issue 2627933003: Bug Fix: ChromeOS Screen Name Mismatch (Closed)
Patch Set: Format Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include <memory> 10 #include <memory>
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 438
439 display::Display old_primary_display = 439 display::Display old_primary_display =
440 display::Screen::GetScreen()->GetPrimaryDisplay(); 440 display::Screen::GetScreen()->GetPrimaryDisplay();
441 DCHECK_EQ(old_primary_display.id(), primary_display_id); 441 DCHECK_EQ(old_primary_display.id(), primary_display_id);
442 442
443 // Swap root windows between current and new primary display. 443 // Swap root windows between current and new primary display.
444 AshWindowTreeHost* primary_host = window_tree_hosts_[primary_display_id]; 444 AshWindowTreeHost* primary_host = window_tree_hosts_[primary_display_id];
445 CHECK(primary_host); 445 CHECK(primary_host);
446 CHECK_NE(primary_host, non_primary_host); 446 CHECK_NE(primary_host, non_primary_host);
447 447
448 aura::Window* primary_window = GetWindow(primary_host);
449 aura::Window* non_primary_window = GetWindow(non_primary_host);
448 window_tree_hosts_[new_primary_display.id()] = primary_host; 450 window_tree_hosts_[new_primary_display.id()] = primary_host;
449 GetRootWindowSettings(GetWindow(primary_host))->display_id = 451 GetRootWindowSettings(primary_window)->display_id = new_primary_display.id();
450 new_primary_display.id();
451 452
452 window_tree_hosts_[old_primary_display.id()] = non_primary_host; 453 window_tree_hosts_[old_primary_display.id()] = non_primary_host;
453 GetRootWindowSettings(GetWindow(non_primary_host))->display_id = 454 GetRootWindowSettings(non_primary_window)->display_id =
454 old_primary_display.id(); 455 old_primary_display.id();
455 456
457 base::string16 old_primary_title = primary_window->GetTitle();
458 primary_window->SetTitle(non_primary_window->GetTitle());
459 non_primary_window->SetTitle(old_primary_title);
460
456 const display::DisplayLayout& layout = 461 const display::DisplayLayout& layout =
457 GetDisplayManager()->GetCurrentDisplayLayout(); 462 GetDisplayManager()->GetCurrentDisplayLayout();
458 // The requested primary id can be same as one in the stored layout 463 // The requested primary id can be same as one in the stored layout
459 // when the primary id is set after new displays are connected. 464 // when the primary id is set after new displays are connected.
460 // Only update the layout if it is requested to swap primary display. 465 // Only update the layout if it is requested to swap primary display.
461 if (layout.primary_id != new_primary_display.id()) { 466 if (layout.primary_id != new_primary_display.id()) {
462 std::unique_ptr<display::DisplayLayout> swapped_layout(layout.Copy()); 467 std::unique_ptr<display::DisplayLayout> swapped_layout(layout.Copy());
463 468
464 std::map<int64_t, display::DisplayPlacement*> id_to_placement; 469 std::map<int64_t, display::DisplayPlacement*> id_to_placement;
465 for (auto& placement : swapped_layout->placement_list) 470 for (auto& placement : swapped_layout->placement_list)
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
890 SetDisplayPropertiesOnHost(ash_host, display); 895 SetDisplayPropertiesOnHost(ash_host, display);
891 896
892 #if defined(OS_CHROMEOS) 897 #if defined(OS_CHROMEOS)
893 if (switches::ConstrainPointerToRoot()) 898 if (switches::ConstrainPointerToRoot())
894 ash_host->ConfineCursorToRootWindow(); 899 ash_host->ConfineCursorToRootWindow();
895 #endif 900 #endif
896 return ash_host; 901 return ash_host;
897 } 902 }
898 903
899 } // namespace ash 904 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698