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/common/shelf/shelf_delegate.h" | 9 #include "ash/common/shelf/shelf_delegate.h" |
9 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" | 10 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" |
10 #include "ash/common/wm/window_state.h" | 11 #include "ash/common/wm/window_state.h" |
11 #include "ash/common/wm_lookup.h" | 12 #include "ash/common/wm_lookup.h" |
12 #include "ash/common/wm_shell.h" | 13 #include "ash/common/wm_shell.h" |
| 14 #include "ash/common/wm_window_property.h" |
13 #include "ash/display/display_manager.h" | 15 #include "ash/display/display_manager.h" |
14 #include "ash/display/screen_orientation_controller_chromeos.h" | 16 #include "ash/display/screen_orientation_controller_chromeos.h" |
15 #include "ash/shelf/shelf_util.h" | |
16 #include "ash/shell.h" | 17 #include "ash/shell.h" |
17 #include "ash/wm/window_state_aura.h" | 18 #include "ash/wm/window_state_aura.h" |
18 #include "ash/wm/window_util.h" | 19 #include "ash/wm/window_util.h" |
19 #include "base/bind.h" | 20 #include "base/bind.h" |
20 #include "chrome/browser/chromeos/arc/arc_auth_service.h" | 21 #include "chrome/browser/chromeos/arc/arc_auth_service.h" |
21 #include "chrome/browser/chromeos/arc/arc_support_host.h" | 22 #include "chrome/browser/chromeos/arc/arc_support_host.h" |
22 #include "chrome/browser/profiles/profile.h" | 23 #include "chrome/browser/profiles/profile.h" |
23 #include "chrome/browser/ui/app_list/arc/arc_app_utils.h" | 24 #include "chrome/browser/ui/app_list/arc/arc_app_utils.h" |
24 #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" |
25 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" | 26 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 TaskIdToShelfAppIdMap::iterator it = task_id_to_shelf_app_id_.find(task_id); | 367 TaskIdToShelfAppIdMap::iterator it = task_id_to_shelf_app_id_.find(task_id); |
367 if (it == task_id_to_shelf_app_id_.end()) | 368 if (it == task_id_to_shelf_app_id_.end()) |
368 return; | 369 return; |
369 | 370 |
370 const std::string& app_id = it->second; | 371 const std::string& app_id = it->second; |
371 | 372 |
372 std::unique_ptr<AppWindow> app_window(new AppWindow(task_id, app_id, this)); | 373 std::unique_ptr<AppWindow> app_window(new AppWindow(task_id, app_id, this)); |
373 app_window->set_widget(views::Widget::GetWidgetForNativeWindow(window)); | 374 app_window->set_widget(views::Widget::GetWidgetForNativeWindow(window)); |
374 RegisterApp(app_window.get()); | 375 RegisterApp(app_window.get()); |
375 DCHECK(app_window->controller()); | 376 DCHECK(app_window->controller()); |
376 ash::SetShelfIDForWindow(app_window->shelf_id(), window); | 377 ash::WmWindowAura::Get(window)->SetIntProperty( |
| 378 ash::WmWindowProperty::SHELF_ID, app_window->shelf_id()); |
377 chrome::MultiUserWindowManager::GetInstance()->SetWindowOwner( | 379 chrome::MultiUserWindowManager::GetInstance()->SetWindowOwner( |
378 window, | 380 window, |
379 user_manager::UserManager::Get()->GetPrimaryUser()->GetAccountId()); | 381 user_manager::UserManager::Get()->GetPrimaryUser()->GetAccountId()); |
380 if (ash::WmShell::Get() | 382 if (ash::WmShell::Get() |
381 ->maximize_mode_controller() | 383 ->maximize_mode_controller() |
382 ->IsMaximizeModeWindowManagerEnabled()) { | 384 ->IsMaximizeModeWindowManagerEnabled()) { |
383 SetOrientationLockForAppWindow(app_window.get()); | 385 SetOrientationLockForAppWindow(app_window.get()); |
384 } | 386 } |
385 task_id_to_app_window_[task_id] = std::move(app_window); | 387 task_id_to_app_window_[task_id] = std::move(app_window); |
386 } | 388 } |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
635 if (orientation_lock == arc::mojom::OrientationLock::CURRENT) { | 637 if (orientation_lock == arc::mojom::OrientationLock::CURRENT) { |
636 // Resolve the orientation when it first resolved. | 638 // Resolve the orientation when it first resolved. |
637 orientation_lock = GetCurrentOrientation(); | 639 orientation_lock = GetCurrentOrientation(); |
638 app_window->set_requested_orientation_lock(orientation_lock); | 640 app_window->set_requested_orientation_lock(orientation_lock); |
639 } | 641 } |
640 | 642 |
641 ash::Shell* shell = ash::Shell::GetInstance(); | 643 ash::Shell* shell = ash::Shell::GetInstance(); |
642 shell->screen_orientation_controller()->LockOrientationForWindow( | 644 shell->screen_orientation_controller()->LockOrientationForWindow( |
643 window, BlinkOrientationLockFromMojom(orientation_lock)); | 645 window, BlinkOrientationLockFromMojom(orientation_lock)); |
644 } | 646 } |
OLD | NEW |