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

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

Issue 2932563002: Implement cursor changing on Mushrome (Closed)
Patch Set: oshima patch take 2 Created 3 years, 6 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 | « ash/BUILD.gn ('k') | ash/shell.h » ('j') | 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/mirror_window_controller.h" 5 #include "ash/display/mirror_window_controller.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #if defined(USE_X11) 9 #if defined(USE_X11)
10 #include <X11/extensions/XInput2.h> 10 #include <X11/extensions/XInput2.h>
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 ++iter; 265 ++iter;
266 } 266 }
267 } 267 }
268 } 268 }
269 } 269 }
270 270
271 void MirrorWindowController::UpdateWindow() { 271 void MirrorWindowController::UpdateWindow() {
272 if (mirroring_host_info_map_.empty()) 272 if (mirroring_host_info_map_.empty())
273 return; 273 return;
274 display::DisplayManager* display_manager = Shell::Get()->display_manager(); 274 display::DisplayManager* display_manager = Shell::Get()->display_manager();
275 display::Screen* screen = display::Screen::GetScreen();
276
275 std::vector<display::ManagedDisplayInfo> display_info_list; 277 std::vector<display::ManagedDisplayInfo> display_info_list;
276 for (auto& pair : mirroring_host_info_map_) 278 // Prune the window on the removed displays.
277 display_info_list.push_back(display_manager->GetDisplayInfo(pair.first)); 279 for (auto& pair : mirroring_host_info_map_) {
280 MirroringHostInfo* info = pair.second;
281 if (screen
282 ->GetDisplayNearestWindow(
283 info->ash_host->AsWindowTreeHost()->window())
284 .is_valid()) {
285 display_info_list.push_back(display_manager->GetDisplayInfo(pair.first));
286 }
287 }
278 UpdateWindow(display_info_list); 288 UpdateWindow(display_info_list);
279 } 289 }
280 290
281 void MirrorWindowController::CloseIfNotNecessary() { 291 void MirrorWindowController::CloseIfNotNecessary() {
282 display::DisplayManager::MultiDisplayMode new_mode = 292 display::DisplayManager::MultiDisplayMode new_mode =
283 GetCurrentMultiDisplayMode(); 293 GetCurrentMultiDisplayMode();
284 if (multi_display_mode_ != new_mode) 294 if (multi_display_mode_ != new_mode) {
285 Close(true); 295 Close(true);
286 multi_display_mode_ = new_mode; 296 multi_display_mode_ = new_mode;
297 } else {
298 UpdateWindow();
299 }
287 } 300 }
288 301
289 void MirrorWindowController::Close(bool delay_host_deletion) { 302 void MirrorWindowController::Close(bool delay_host_deletion) {
290 for (auto& info : mirroring_host_info_map_) 303 for (auto& info : mirroring_host_info_map_)
291 CloseAndDeleteHost(info.second, delay_host_deletion); 304 CloseAndDeleteHost(info.second, delay_host_deletion);
292 305
293 mirroring_host_info_map_.clear(); 306 mirroring_host_info_map_.clear();
294 if (reflector_) { 307 if (reflector_) {
295 aura::Env::GetInstance()->context_factory_private()->RemoveReflector( 308 aura::Env::GetInstance()->context_factory_private()->RemoveReflector(
296 reflector_.get()); 309 reflector_.get());
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 // EventProcessor may be accessed after this call if the mirroring window 397 // EventProcessor may be accessed after this call if the mirroring window
385 // was deleted as a result of input event (e.g. shortcut), so don't delete 398 // was deleted as a result of input event (e.g. shortcut), so don't delete
386 // now. 399 // now.
387 if (delay_host_deletion) 400 if (delay_host_deletion)
388 base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, host_info); 401 base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, host_info);
389 else 402 else
390 delete host_info; 403 delete host_info;
391 } 404 }
392 405
393 } // namespace ash 406 } // namespace ash
OLDNEW
« no previous file with comments | « ash/BUILD.gn ('k') | ash/shell.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698