Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Side by Side Diff: chrome/browser/ui/ash/launcher/arc_app_window_launcher_controller.cc

Issue 2134753004: mash: Partially migrate ScreenOrientationController to ash/common. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sync and rebase. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ash/display/screen_orientation_controller_chromeos.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "ash/common/wm/maximize_mode/maximize_mode_controller.h" 6 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h"
7 #include "ash/common/wm/window_state.h" 7 #include "ash/common/wm/window_state.h"
8 #include "ash/common/wm_lookup.h"
8 #include "ash/common/wm_shell.h" 9 #include "ash/common/wm_shell.h"
9 #include "ash/display/display_manager.h" 10 #include "ash/display/display_manager.h"
10 #include "ash/display/screen_orientation_controller_chromeos.h" 11 #include "ash/display/screen_orientation_controller_chromeos.h"
11 #include "ash/shelf/shelf_delegate.h" 12 #include "ash/shelf/shelf_delegate.h"
12 #include "ash/shelf/shelf_util.h" 13 #include "ash/shelf/shelf_util.h"
13 #include "ash/shell.h" 14 #include "ash/shell.h"
14 #include "ash/wm/window_state_aura.h" 15 #include "ash/wm/window_state_aura.h"
15 #include "ash/wm/window_util.h" 16 #include "ash/wm/window_util.h"
16 #include "base/bind.h" 17 #include "base/bind.h"
17 #include "chrome/browser/chromeos/arc/arc_auth_service.h" 18 #include "chrome/browser/chromeos/arc/arc_auth_service.h"
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after
573 if (!controller->window_count()) { 574 if (!controller->window_count()) {
574 ash::ShelfID shelf_id = app_window->shelf_id(); 575 ash::ShelfID shelf_id = app_window->shelf_id();
575 owner()->CloseLauncherItem(shelf_id); 576 owner()->CloseLauncherItem(shelf_id);
576 app_controller_map_.erase(it); 577 app_controller_map_.erase(it);
577 } 578 }
578 app_window->ResetController(); 579 app_window->ResetController();
579 } 580 }
580 581
581 void ArcAppWindowLauncherController::SetOrientationLockForAppWindow( 582 void ArcAppWindowLauncherController::SetOrientationLockForAppWindow(
582 AppWindow* app_window) { 583 AppWindow* app_window) {
583 ash::Shell* shell = ash::Shell::GetInstance(); 584 ash::WmWindow* window =
584 aura::Window* window = app_window->widget()->GetNativeWindow(); 585 ash::WmLookup::Get()->GetWindowForWidget(app_window->widget());
585 if (!window) 586 if (!window)
586 return; 587 return;
587 arc::mojom::OrientationLock orientation_lock; 588 arc::mojom::OrientationLock orientation_lock;
588 if (app_window->has_requested_orientation_lock()) { 589 if (app_window->has_requested_orientation_lock()) {
589 orientation_lock = app_window->requested_orientation_lock(); 590 orientation_lock = app_window->requested_orientation_lock();
590 } else { 591 } else {
591 ArcAppListPrefs* prefs = ArcAppListPrefs::Get(observed_profile_); 592 ArcAppListPrefs* prefs = ArcAppListPrefs::Get(observed_profile_);
592 std::unique_ptr<ArcAppListPrefs::AppInfo> app_info = 593 std::unique_ptr<ArcAppListPrefs::AppInfo> app_info =
593 prefs->GetApp(app_window->app_id()); 594 prefs->GetApp(app_window->app_id());
594 if (!app_info) 595 if (!app_info)
595 return; 596 return;
596 orientation_lock = app_info->orientation_lock; 597 orientation_lock = app_info->orientation_lock;
597 } 598 }
598 599
599 if (orientation_lock == arc::mojom::OrientationLock::CURRENT) { 600 if (orientation_lock == arc::mojom::OrientationLock::CURRENT) {
600 // Resolve the orientation when it first resolved. 601 // Resolve the orientation when it first resolved.
601 orientation_lock = GetCurrentOrientation(); 602 orientation_lock = GetCurrentOrientation();
602 app_window->set_requested_orientation_lock(orientation_lock); 603 app_window->set_requested_orientation_lock(orientation_lock);
603 } 604 }
604 605
606 ash::Shell* shell = ash::Shell::GetInstance();
605 shell->screen_orientation_controller()->LockOrientationForWindow( 607 shell->screen_orientation_controller()->LockOrientationForWindow(
606 window, BlinkOrientationLockFromMojom(orientation_lock)); 608 window, BlinkOrientationLockFromMojom(orientation_lock));
607 } 609 }
OLDNEW
« no previous file with comments | « ash/display/screen_orientation_controller_chromeos.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698