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

Side by Side Diff: chrome/browser/ui/ash/launcher/arc_app_window_launcher_controller.cc

Issue 2256273003: arc: Fix crash on window close (on close race condition). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comment added Created 4 years, 4 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 | chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl_unittest.cc » ('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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #include "chrome/browser/ui/ash/launcher/arc_app_window_launcher_controller.h" 4 #include "chrome/browser/ui/ash/launcher/arc_app_window_launcher_controller.h"
5 5
6 #include <string> 6 #include <string>
7 7
8 #include "ash/common/shelf/shelf_delegate.h" 8 #include "ash/common/shelf/shelf_delegate.h"
9 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" 9 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h"
10 #include "ash/common/wm/window_state.h" 10 #include "ash/common/wm/window_state.h"
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 } 325 }
326 326
327 void ArcAppWindowLauncherController::OnWindowDestroying(aura::Window* window) { 327 void ArcAppWindowLauncherController::OnWindowDestroying(aura::Window* window) {
328 auto it = 328 auto it =
329 std::find(observed_windows_.begin(), observed_windows_.end(), window); 329 std::find(observed_windows_.begin(), observed_windows_.end(), window);
330 DCHECK(it != observed_windows_.end()); 330 DCHECK(it != observed_windows_.end());
331 observed_windows_.erase(it); 331 observed_windows_.erase(it);
332 window->RemoveObserver(this); 332 window->RemoveObserver(this);
333 333
334 for (auto& it : task_id_to_app_window_) { 334 for (auto& it : task_id_to_app_window_) {
335 if (it.second->widget() == views::Widget::GetWidgetForNativeWindow(window)) 335 if (it.second->GetNativeWindow() == window) {
336 it.second->set_widget(nullptr); 336 OnTaskDestroyed(it.second->task_id());
337 break;
338 }
337 } 339 }
338 } 340 }
339 341
340 ArcAppWindowLauncherController::AppWindow* 342 ArcAppWindowLauncherController::AppWindow*
341 ArcAppWindowLauncherController::GetAppWindowForTask(int task_id) { 343 ArcAppWindowLauncherController::GetAppWindowForTask(int task_id) {
342 TaskIdToAppWindow::iterator it = task_id_to_app_window_.find(task_id); 344 TaskIdToAppWindow::iterator it = task_id_to_app_window_.find(task_id);
343 if (it == task_id_to_app_window_.end()) 345 if (it == task_id_to_app_window_.end())
344 return nullptr; 346 return nullptr;
345 return it->second.get(); 347 return it->second.get();
346 } 348 }
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
627 if (orientation_lock == arc::mojom::OrientationLock::CURRENT) { 629 if (orientation_lock == arc::mojom::OrientationLock::CURRENT) {
628 // Resolve the orientation when it first resolved. 630 // Resolve the orientation when it first resolved.
629 orientation_lock = GetCurrentOrientation(); 631 orientation_lock = GetCurrentOrientation();
630 app_window->set_requested_orientation_lock(orientation_lock); 632 app_window->set_requested_orientation_lock(orientation_lock);
631 } 633 }
632 634
633 ash::Shell* shell = ash::Shell::GetInstance(); 635 ash::Shell* shell = ash::Shell::GetInstance();
634 shell->screen_orientation_controller()->LockOrientationForWindow( 636 shell->screen_orientation_controller()->LockOrientationForWindow(
635 window, BlinkOrientationLockFromMojom(orientation_lock)); 637 window, BlinkOrientationLockFromMojom(orientation_lock));
636 } 638 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698