| 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 "ash/common/wm/maximize_mode/maximize_mode_controller.h" | 6 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" |
| 7 #include "ash/common/wm/window_state.h" | 7 #include "ash/common/wm/window_state.h" |
| 8 #include "ash/common/wm_lookup.h" |
| 8 #include "ash/common/wm_shell.h" | 9 #include "ash/common/wm_shell.h" |
| 9 #include "ash/display/screen_orientation_controller_chromeos.h" | 10 #include "ash/display/screen_orientation_controller_chromeos.h" |
| 10 #include "ash/shelf/shelf_delegate.h" | 11 #include "ash/shelf/shelf_delegate.h" |
| 11 #include "ash/shelf/shelf_util.h" | 12 #include "ash/shelf/shelf_util.h" |
| 12 #include "ash/shell.h" | 13 #include "ash/shell.h" |
| 13 #include "ash/wm/window_state_aura.h" | 14 #include "ash/wm/window_state_aura.h" |
| 14 #include "ash/wm/window_util.h" | 15 #include "ash/wm/window_util.h" |
| 15 #include "base/bind.h" | 16 #include "base/bind.h" |
| 16 #include "chrome/browser/chromeos/arc/arc_auth_service.h" | 17 #include "chrome/browser/chromeos/arc/arc_auth_service.h" |
| 17 #include "chrome/browser/chromeos/arc/arc_support_host.h" | 18 #include "chrome/browser/chromeos/arc/arc_support_host.h" |
| (...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 550 if (!controller->window_count()) { | 551 if (!controller->window_count()) { |
| 551 ash::ShelfID shelf_id = app_window->shelf_id(); | 552 ash::ShelfID shelf_id = app_window->shelf_id(); |
| 552 owner()->CloseLauncherItem(shelf_id); | 553 owner()->CloseLauncherItem(shelf_id); |
| 553 app_controller_map_.erase(it); | 554 app_controller_map_.erase(it); |
| 554 } | 555 } |
| 555 app_window->ResetController(); | 556 app_window->ResetController(); |
| 556 } | 557 } |
| 557 | 558 |
| 558 void ArcAppWindowLauncherController::SetOrientationLockForAppWindow( | 559 void ArcAppWindowLauncherController::SetOrientationLockForAppWindow( |
| 559 AppWindow* app_window) { | 560 AppWindow* app_window) { |
| 560 ash::Shell* shell = ash::Shell::GetInstance(); | 561 ash::WmWindow* window = |
| 561 aura::Window* window = app_window->widget()->GetNativeWindow(); | 562 ash::WmLookup::Get()->GetWindowForWidget(app_window->widget()); |
| 562 if (!window) | 563 if (!window) |
| 563 return; | 564 return; |
| 564 arc::mojom::OrientationLock orientation_lock; | 565 arc::mojom::OrientationLock orientation_lock; |
| 565 if (app_window->has_requested_orientation_lock()) { | 566 if (app_window->has_requested_orientation_lock()) { |
| 566 orientation_lock = app_window->requested_orientation_lock(); | 567 orientation_lock = app_window->requested_orientation_lock(); |
| 567 } else { | 568 } else { |
| 568 ArcAppListPrefs* prefs = ArcAppListPrefs::Get(observed_profile_); | 569 ArcAppListPrefs* prefs = ArcAppListPrefs::Get(observed_profile_); |
| 569 std::unique_ptr<ArcAppListPrefs::AppInfo> app_info = | 570 std::unique_ptr<ArcAppListPrefs::AppInfo> app_info = |
| 570 prefs->GetApp(app_window->app_id()); | 571 prefs->GetApp(app_window->app_id()); |
| 571 if (!app_info) | 572 if (!app_info) |
| 572 return; | 573 return; |
| 573 orientation_lock = app_info->orientation_lock; | 574 orientation_lock = app_info->orientation_lock; |
| 574 } | 575 } |
| 576 ash::Shell* shell = ash::Shell::GetInstance(); |
| 575 shell->screen_orientation_controller()->LockOrientationForWindow( | 577 shell->screen_orientation_controller()->LockOrientationForWindow( |
| 576 window, BlinkOrientationLockFromMojom(orientation_lock)); | 578 window, BlinkOrientationLockFromMojom(orientation_lock)); |
| 577 } | 579 } |
| OLD | NEW |