Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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()); |
|
khmel
2016/08/18 16:09:29
Fix race condition on Close (Close event before On
| |
| 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 Loading... | |
| 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 } |
| OLD | NEW |