| 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 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 561 ->maximize_mode_controller() | 561 ->maximize_mode_controller() |
| 562 ->IsMaximizeModeWindowManagerEnabled()) { | 562 ->IsMaximizeModeWindowManagerEnabled()) { |
| 563 AppWindow* app_window = info->app_window(); | 563 AppWindow* app_window = info->app_window(); |
| 564 if (app_window) | 564 if (app_window) |
| 565 SetOrientationLockForAppWindow(app_window); | 565 SetOrientationLockForAppWindow(app_window); |
| 566 } | 566 } |
| 567 } | 567 } |
| 568 | 568 |
| 569 AppWindowLauncherItemController* | 569 AppWindowLauncherItemController* |
| 570 ArcAppWindowLauncherController::ControllerForWindow(aura::Window* window) { | 570 ArcAppWindowLauncherController::ControllerForWindow(aura::Window* window) { |
| 571 if (!window) |
| 572 return nullptr; |
| 573 |
| 571 AppWindow* app_window = GetAppWindowForTask(active_task_id_); | 574 AppWindow* app_window = GetAppWindowForTask(active_task_id_); |
| 572 if (app_window && | 575 if (app_window && |
| 573 app_window->widget() == views::Widget::GetWidgetForNativeWindow(window)) { | 576 app_window->widget() == views::Widget::GetWidgetForNativeWindow(window)) { |
| 574 return app_window->controller(); | 577 return app_window->controller(); |
| 575 } | 578 } |
| 576 | 579 |
| 577 for (auto& it : task_id_to_app_window_info_) { | 580 for (auto& it : task_id_to_app_window_info_) { |
| 578 AppWindow* app_window = it.second->app_window(); | 581 AppWindow* app_window = it.second->app_window(); |
| 579 if (app_window && | 582 if (app_window && |
| 580 app_window->widget() == | 583 app_window->widget() == |
| 581 views::Widget::GetWidgetForNativeWindow(window)) { | 584 views::Widget::GetWidgetForNativeWindow(window)) { |
| 582 return it.second->app_window()->controller(); | 585 return it.second->app_window()->controller(); |
| 583 } | 586 } |
| 584 } | 587 } |
| 585 | 588 |
| 586 return nullptr; | 589 return nullptr; |
| 587 } | 590 } |
| 588 | 591 |
| 589 void ArcAppWindowLauncherController::OnWindowActivated( | 592 void ArcAppWindowLauncherController::OnWindowActivated( |
| 590 aura::client::ActivationChangeObserver::ActivationReason reason, | 593 aura::client::ActivationChangeObserver::ActivationReason reason, |
| 591 aura::Window* gained_active, | 594 aura::Window* gained_active, |
| 592 aura::Window* lost_active) { | 595 aura::Window* lost_active) { |
| 596 AppWindowLauncherController::OnWindowActivated(reason, gained_active, |
| 597 lost_active); |
| 593 OnTaskSetActive(active_task_id_); | 598 OnTaskSetActive(active_task_id_); |
| 594 } | 599 } |
| 595 | 600 |
| 596 void ArcAppWindowLauncherController::OnMaximizeModeStarted() { | 601 void ArcAppWindowLauncherController::OnMaximizeModeStarted() { |
| 597 for (auto& it : task_id_to_app_window_info_) { | 602 for (auto& it : task_id_to_app_window_info_) { |
| 598 AppWindow* app_window = it.second->app_window(); | 603 AppWindow* app_window = it.second->app_window(); |
| 599 if (app_window) | 604 if (app_window) |
| 600 SetOrientationLockForAppWindow(app_window); | 605 SetOrientationLockForAppWindow(app_window); |
| 601 } | 606 } |
| 602 } | 607 } |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 720 const std::string arc_app_id = exo::ShellSurface::GetApplicationId(window); | 725 const std::string arc_app_id = exo::ShellSurface::GetApplicationId(window); |
| 721 if (arc_app_id.empty()) | 726 if (arc_app_id.empty()) |
| 722 return -1; | 727 return -1; |
| 723 | 728 |
| 724 int task_id = -1; | 729 int task_id = -1; |
| 725 if (sscanf(arc_app_id.c_str(), "org.chromium.arc.%d", &task_id) != 1) | 730 if (sscanf(arc_app_id.c_str(), "org.chromium.arc.%d", &task_id) != 1) |
| 726 return -1; | 731 return -1; |
| 727 | 732 |
| 728 return task_id; | 733 return task_id; |
| 729 } | 734 } |
| OLD | NEW |