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 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 if (window->type() != ui::wm::WINDOW_TYPE_NORMAL) | 292 if (window->type() != ui::wm::WINDOW_TYPE_NORMAL) |
293 return; | 293 return; |
294 observed_windows_.push_back(window); | 294 observed_windows_.push_back(window); |
295 window->AddObserver(this); | 295 window->AddObserver(this); |
296 } | 296 } |
297 | 297 |
298 void ArcAppWindowLauncherController::OnWindowVisibilityChanging( | 298 void ArcAppWindowLauncherController::OnWindowVisibilityChanging( |
299 aura::Window* window, | 299 aura::Window* window, |
300 bool visible) { | 300 bool visible) { |
301 // The application id property should be set at this time. | 301 // The application id property should be set at this time. |
302 if (visible) | 302 if (visible && observed_profile_ == owner()->GetProfile()) |
303 AttachControllerToWindowIfNeeded(window); | 303 AttachControllerToWindowIfNeeded(window); |
304 } | 304 } |
305 | 305 |
306 void ArcAppWindowLauncherController::OnWindowDestroying(aura::Window* window) { | 306 void ArcAppWindowLauncherController::OnWindowDestroying(aura::Window* window) { |
307 auto it = | 307 auto it = |
308 std::find(observed_windows_.begin(), observed_windows_.end(), window); | 308 std::find(observed_windows_.begin(), observed_windows_.end(), window); |
309 DCHECK(it != observed_windows_.end()); | 309 DCHECK(it != observed_windows_.end()); |
310 observed_windows_.erase(it); | 310 observed_windows_.erase(it); |
311 window->RemoveObserver(this); | 311 window->RemoveObserver(this); |
312 | 312 |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 } | 414 } |
415 | 415 |
416 void ArcAppWindowLauncherController::OnTaskCreated( | 416 void ArcAppWindowLauncherController::OnTaskCreated( |
417 int task_id, | 417 int task_id, |
418 const std::string& package_name, | 418 const std::string& package_name, |
419 const std::string& activity_name) { | 419 const std::string& activity_name) { |
420 DCHECK(!GetAppWindowForTask(task_id)); | 420 DCHECK(!GetAppWindowForTask(task_id)); |
421 task_id_to_shelf_app_id_[task_id] = GetShelfAppIdFromArcAppId( | 421 task_id_to_shelf_app_id_[task_id] = GetShelfAppIdFromArcAppId( |
422 ArcAppListPrefs::GetAppId(package_name, activity_name)); | 422 ArcAppListPrefs::GetAppId(package_name, activity_name)); |
423 | 423 |
| 424 // Don't create shelf icon for non-primary user. |
| 425 if (observed_profile_ != owner()->GetProfile()) |
| 426 return; |
| 427 |
424 AttachControllerToWindowsIfNeeded(); | 428 AttachControllerToWindowsIfNeeded(); |
425 } | 429 } |
426 | 430 |
427 void ArcAppWindowLauncherController::OnTaskDestroyed(int task_id) { | 431 void ArcAppWindowLauncherController::OnTaskDestroyed(int task_id) { |
428 auto it = task_id_to_app_window_.find(task_id); | 432 auto it = task_id_to_app_window_.find(task_id); |
429 if (it != task_id_to_app_window_.end()) { | 433 if (it != task_id_to_app_window_.end()) { |
430 AppWindow* app_window = it->second.get(); | 434 AppWindow* app_window = it->second.get(); |
431 UnregisterApp(app_window, true); | 435 UnregisterApp(app_window, true); |
432 task_id_to_app_window_.erase(it); | 436 task_id_to_app_window_.erase(it); |
433 } | 437 } |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
631 if (orientation_lock == arc::mojom::OrientationLock::CURRENT) { | 635 if (orientation_lock == arc::mojom::OrientationLock::CURRENT) { |
632 // Resolve the orientation when it first resolved. | 636 // Resolve the orientation when it first resolved. |
633 orientation_lock = GetCurrentOrientation(); | 637 orientation_lock = GetCurrentOrientation(); |
634 app_window->set_requested_orientation_lock(orientation_lock); | 638 app_window->set_requested_orientation_lock(orientation_lock); |
635 } | 639 } |
636 | 640 |
637 ash::Shell* shell = ash::Shell::GetInstance(); | 641 ash::Shell* shell = ash::Shell::GetInstance(); |
638 shell->screen_orientation_controller()->LockOrientationForWindow( | 642 shell->screen_orientation_controller()->LockOrientationForWindow( |
639 window, BlinkOrientationLockFromMojom(orientation_lock)); | 643 window, BlinkOrientationLockFromMojom(orientation_lock)); |
640 } | 644 } |
OLD | NEW |