| 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" |
| 11 #include "ash/common/wm_shell.h" | |
| 12 #include "ash/common/wm_window.h" | 11 #include "ash/common/wm_window.h" |
| 13 #include "ash/display/screen_orientation_controller_chromeos.h" | 12 #include "ash/display/screen_orientation_controller_chromeos.h" |
| 14 #include "ash/shared/app_types.h" | 13 #include "ash/shared/app_types.h" |
| 15 #include "ash/shell.h" | 14 #include "ash/shell.h" |
| 16 #include "ash/wm/window_properties.h" | 15 #include "ash/wm/window_properties.h" |
| 17 #include "ash/wm/window_state_aura.h" | 16 #include "ash/wm/window_state_aura.h" |
| 18 #include "ash/wm/window_util.h" | 17 #include "ash/wm/window_util.h" |
| 19 #include "base/bind.h" | 18 #include "base/bind.h" |
| 20 #include "base/memory/ptr_util.h" | 19 #include "base/memory/ptr_util.h" |
| 21 #include "chrome/browser/chromeos/arc/arc_support_host.h" | 20 #include "chrome/browser/chromeos/arc/arc_support_host.h" |
| (...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 } | 415 } |
| 417 | 416 |
| 418 views::Widget* widget = views::Widget::GetWidgetForNativeWindow(window); | 417 views::Widget* widget = views::Widget::GetWidgetForNativeWindow(window); |
| 419 DCHECK(widget); | 418 DCHECK(widget); |
| 420 DCHECK(!info->app_window()); | 419 DCHECK(!info->app_window()); |
| 421 info->set_app_window( | 420 info->set_app_window( |
| 422 base::MakeUnique<AppWindow>(task_id, info->app_shelf_id(), widget, this)); | 421 base::MakeUnique<AppWindow>(task_id, info->app_shelf_id(), widget, this)); |
| 423 RegisterApp(info); | 422 RegisterApp(info); |
| 424 DCHECK(info->app_window()->controller()); | 423 DCHECK(info->app_window()->controller()); |
| 425 window->SetProperty(ash::kShelfIDKey, info->app_window()->shelf_id()); | 424 window->SetProperty(ash::kShelfIDKey, info->app_window()->shelf_id()); |
| 426 if (ash::WmShell::Get() | 425 if (ash::Shell::Get() |
| 427 ->maximize_mode_controller() | 426 ->maximize_mode_controller() |
| 428 ->IsMaximizeModeWindowManagerEnabled()) { | 427 ->IsMaximizeModeWindowManagerEnabled()) { |
| 429 SetOrientationLockForAppWindow(info->app_window()); | 428 SetOrientationLockForAppWindow(info->app_window()); |
| 430 } | 429 } |
| 431 } | 430 } |
| 432 | 431 |
| 433 void ArcAppWindowLauncherController::OnAppReadyChanged( | 432 void ArcAppWindowLauncherController::OnAppReadyChanged( |
| 434 const std::string& arc_app_id, | 433 const std::string& arc_app_id, |
| 435 bool ready) { | 434 bool ready) { |
| 436 if (!ready) | 435 if (!ready) |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 548 void ArcAppWindowLauncherController::OnTaskOrientationLockRequested( | 547 void ArcAppWindowLauncherController::OnTaskOrientationLockRequested( |
| 549 int32_t task_id, | 548 int32_t task_id, |
| 550 const arc::mojom::OrientationLock orientation_lock) { | 549 const arc::mojom::OrientationLock orientation_lock) { |
| 551 // Don't save to AppInfo in prefs because this is requested in runtime. | 550 // Don't save to AppInfo in prefs because this is requested in runtime. |
| 552 AppWindowInfo* info = GetAppWindowInfoForTask(task_id); | 551 AppWindowInfo* info = GetAppWindowInfoForTask(task_id); |
| 553 DCHECK(info); | 552 DCHECK(info); |
| 554 if (!info) | 553 if (!info) |
| 555 return; | 554 return; |
| 556 info->set_requested_orientation_lock(orientation_lock); | 555 info->set_requested_orientation_lock(orientation_lock); |
| 557 | 556 |
| 558 if (ash::WmShell::Get() | 557 if (ash::Shell::Get() |
| 559 ->maximize_mode_controller() | 558 ->maximize_mode_controller() |
| 560 ->IsMaximizeModeWindowManagerEnabled()) { | 559 ->IsMaximizeModeWindowManagerEnabled()) { |
| 561 AppWindow* app_window = info->app_window(); | 560 AppWindow* app_window = info->app_window(); |
| 562 if (app_window) | 561 if (app_window) |
| 563 SetOrientationLockForAppWindow(app_window); | 562 SetOrientationLockForAppWindow(app_window); |
| 564 } | 563 } |
| 565 } | 564 } |
| 566 | 565 |
| 567 AppWindowLauncherItemController* | 566 AppWindowLauncherItemController* |
| 568 ArcAppWindowLauncherController::ControllerForWindow(aura::Window* window) { | 567 ArcAppWindowLauncherController::ControllerForWindow(aura::Window* window) { |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 718 const std::string arc_app_id = exo::ShellSurface::GetApplicationId(window); | 717 const std::string arc_app_id = exo::ShellSurface::GetApplicationId(window); |
| 719 if (arc_app_id.empty()) | 718 if (arc_app_id.empty()) |
| 720 return -1; | 719 return -1; |
| 721 | 720 |
| 722 int task_id = -1; | 721 int task_id = -1; |
| 723 if (sscanf(arc_app_id.c_str(), "org.chromium.arc.%d", &task_id) != 1) | 722 if (sscanf(arc_app_id.c_str(), "org.chromium.arc.%d", &task_id) != 1) |
| 724 return -1; | 723 return -1; |
| 725 | 724 |
| 726 return task_id; | 725 return task_id; |
| 727 } | 726 } |
| OLD | NEW |