| 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/aura/wm_window_aura.h" | 8 #include "ash/aura/wm_window_aura.h" |
| 9 #include "ash/common/shelf/shelf_delegate.h" | 9 #include "ash/common/shelf/shelf_delegate.h" |
| 10 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" | 10 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" |
| 11 #include "ash/common/wm/window_state.h" | 11 #include "ash/common/wm/window_state.h" |
| 12 #include "ash/common/wm_lookup.h" | 12 #include "ash/common/wm_lookup.h" |
| 13 #include "ash/common/wm_shell.h" | 13 #include "ash/common/wm_shell.h" |
| 14 #include "ash/common/wm_window_property.h" | 14 #include "ash/common/wm_window_property.h" |
| 15 #include "ash/display/screen_orientation_controller_chromeos.h" | 15 #include "ash/display/screen_orientation_controller_chromeos.h" |
| 16 #include "ash/shared/app_types.h" | 16 #include "ash/shared/app_types.h" |
| 17 #include "ash/shell.h" | 17 #include "ash/shell.h" |
| 18 #include "ash/wm/window_state_aura.h" | 18 #include "ash/wm/window_state_aura.h" |
| 19 #include "ash/wm/window_util.h" | 19 #include "ash/wm/window_util.h" |
| 20 #include "base/bind.h" | 20 #include "base/bind.h" |
| 21 #include "chrome/browser/chromeos/arc/arc_auth_service.h" | 21 #include "chrome/browser/chromeos/arc/arc_session_manager.h" |
| 22 #include "chrome/browser/chromeos/arc/arc_support_host.h" | 22 #include "chrome/browser/chromeos/arc/arc_support_host.h" |
| 23 #include "chrome/browser/profiles/profile.h" | 23 #include "chrome/browser/profiles/profile.h" |
| 24 #include "chrome/browser/ui/app_list/arc/arc_app_utils.h" | 24 #include "chrome/browser/ui/app_list/arc/arc_app_utils.h" |
| 25 #include "chrome/browser/ui/ash/launcher/arc_app_window_launcher_item_controller
.h" | 25 #include "chrome/browser/ui/ash/launcher/arc_app_window_launcher_item_controller
.h" |
| 26 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" | 26 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" |
| 27 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h" | 27 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h" |
| 28 #include "components/arc/arc_bridge_service.h" | 28 #include "components/arc/arc_bridge_service.h" |
| 29 #include "components/exo/shell_surface.h" | 29 #include "components/exo/shell_surface.h" |
| 30 #include "components/signin/core/account_id/account_id.h" | 30 #include "components/signin/core/account_id/account_id.h" |
| 31 #include "components/user_manager/user_manager.h" | 31 #include "components/user_manager/user_manager.h" |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 ArcAppWindowLauncherItemController* controller_ = nullptr; | 252 ArcAppWindowLauncherItemController* controller_ = nullptr; |
| 253 // Unowned pointer, represents host Arc window. | 253 // Unowned pointer, represents host Arc window. |
| 254 | 254 |
| 255 DISALLOW_COPY_AND_ASSIGN(AppWindow); | 255 DISALLOW_COPY_AND_ASSIGN(AppWindow); |
| 256 }; | 256 }; |
| 257 | 257 |
| 258 ArcAppWindowLauncherController::ArcAppWindowLauncherController( | 258 ArcAppWindowLauncherController::ArcAppWindowLauncherController( |
| 259 ChromeLauncherController* owner, | 259 ChromeLauncherController* owner, |
| 260 ash::ShelfDelegate* shelf_delegate) | 260 ash::ShelfDelegate* shelf_delegate) |
| 261 : AppWindowLauncherController(owner), shelf_delegate_(shelf_delegate) { | 261 : AppWindowLauncherController(owner), shelf_delegate_(shelf_delegate) { |
| 262 if (arc::ArcAuthService::IsAllowedForProfile(owner->profile())) { | 262 if (arc::ArcSessionManager::IsAllowedForProfile(owner->profile())) { |
| 263 observed_profile_ = owner->profile(); | 263 observed_profile_ = owner->profile(); |
| 264 StartObserving(observed_profile_); | 264 StartObserving(observed_profile_); |
| 265 } | 265 } |
| 266 } | 266 } |
| 267 | 267 |
| 268 ArcAppWindowLauncherController::~ArcAppWindowLauncherController() { | 268 ArcAppWindowLauncherController::~ArcAppWindowLauncherController() { |
| 269 if (observed_profile_) | 269 if (observed_profile_) |
| 270 StopObserving(observed_profile_); | 270 StopObserving(observed_profile_); |
| 271 if (observing_shell_) | 271 if (observing_shell_) |
| 272 ash::WmShell::Get()->RemoveShellObserver(this); | 272 ash::WmShell::Get()->RemoveShellObserver(this); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 // Some controllers might have no windows attached, for example background | 312 // Some controllers might have no windows attached, for example background |
| 313 // task when foreground tasks is in full screen. | 313 // task when foreground tasks is in full screen. |
| 314 for (const auto& it : app_controller_map_) | 314 for (const auto& it : app_controller_map_) |
| 315 owner()->CloseLauncherItem(it.second->shelf_id()); | 315 owner()->CloseLauncherItem(it.second->shelf_id()); |
| 316 app_controller_map_.clear(); | 316 app_controller_map_.clear(); |
| 317 } | 317 } |
| 318 } | 318 } |
| 319 | 319 |
| 320 void ArcAppWindowLauncherController::AdditionalUserAddedToSession( | 320 void ArcAppWindowLauncherController::AdditionalUserAddedToSession( |
| 321 Profile* profile) { | 321 Profile* profile) { |
| 322 DCHECK(!arc::ArcAuthService::IsAllowedForProfile(profile)); | 322 DCHECK(!arc::ArcSessionManager::IsAllowedForProfile(profile)); |
| 323 } | 323 } |
| 324 | 324 |
| 325 void ArcAppWindowLauncherController::OnWindowInitialized(aura::Window* window) { | 325 void ArcAppWindowLauncherController::OnWindowInitialized(aura::Window* window) { |
| 326 // An arc window has type WINDOW_TYPE_NORMAL, a WindowDelegate and | 326 // An arc window has type WINDOW_TYPE_NORMAL, a WindowDelegate and |
| 327 // is a top level views widget. | 327 // is a top level views widget. |
| 328 if (window->type() != ui::wm::WINDOW_TYPE_NORMAL || !window->delegate()) | 328 if (window->type() != ui::wm::WINDOW_TYPE_NORMAL || !window->delegate()) |
| 329 return; | 329 return; |
| 330 views::Widget* widget = views::Widget::GetWidgetForNativeWindow(window); | 330 views::Widget* widget = views::Widget::GetWidgetForNativeWindow(window); |
| 331 if (!widget || !widget->is_top_level()) | 331 if (!widget || !widget->is_top_level()) |
| 332 return; | 332 return; |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 716 | 716 |
| 717 if (orientation_lock == arc::mojom::OrientationLock::CURRENT) { | 717 if (orientation_lock == arc::mojom::OrientationLock::CURRENT) { |
| 718 // Resolve the orientation when it first resolved. | 718 // Resolve the orientation when it first resolved. |
| 719 orientation_lock = GetCurrentOrientation(); | 719 orientation_lock = GetCurrentOrientation(); |
| 720 info->set_requested_orientation_lock(orientation_lock); | 720 info->set_requested_orientation_lock(orientation_lock); |
| 721 } | 721 } |
| 722 ash::Shell* shell = ash::Shell::GetInstance(); | 722 ash::Shell* shell = ash::Shell::GetInstance(); |
| 723 shell->screen_orientation_controller()->LockOrientationForWindow( | 723 shell->screen_orientation_controller()->LockOrientationForWindow( |
| 724 window, BlinkOrientationLockFromMojom(orientation_lock)); | 724 window, BlinkOrientationLockFromMojom(orientation_lock)); |
| 725 } | 725 } |
| OLD | NEW |