| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 | 4 |
| 5 #include "chrome/browser/chromeos/arc/boot_phase_monitor/arc_instance_throttle.h
" | 5 #include "chrome/browser/chromeos/arc/boot_phase_monitor/arc_instance_throttle.h
" |
| 6 | 6 |
| 7 #include "ash/common/wm_shell.h" | |
| 8 #include "ash/common/wm_window.h" | 7 #include "ash/common/wm_window.h" |
| 9 #include "ash/shared/app_types.h" | 8 #include "ash/shared/app_types.h" |
| 10 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "ash/wm/window_util.h" |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "chromeos/dbus/dbus_thread_manager.h" | 13 #include "chromeos/dbus/dbus_thread_manager.h" |
| 14 #include "chromeos/dbus/session_manager_client.h" | 14 #include "chromeos/dbus/session_manager_client.h" |
| 15 #include "ui/wm/public/activation_client.h" | 15 #include "ui/wm/public/activation_client.h" |
| 16 | 16 |
| 17 namespace arc { | 17 namespace arc { |
| 18 | 18 |
| 19 namespace { | 19 namespace { |
| 20 | 20 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 46 ? login_manager::CONTAINER_CPU_RESTRICTION_BACKGROUND | 46 ? login_manager::CONTAINER_CPU_RESTRICTION_BACKGROUND |
| 47 : login_manager::CONTAINER_CPU_RESTRICTION_FOREGROUND; | 47 : login_manager::CONTAINER_CPU_RESTRICTION_FOREGROUND; |
| 48 session_manager_client->SetArcCpuRestriction(state, | 48 session_manager_client->SetArcCpuRestriction(state, |
| 49 base::Bind(OnDBusReply, state)); | 49 base::Bind(OnDBusReply, state)); |
| 50 } | 50 } |
| 51 | 51 |
| 52 } // namespace | 52 } // namespace |
| 53 | 53 |
| 54 ArcInstanceThrottle::ArcInstanceThrottle() { | 54 ArcInstanceThrottle::ArcInstanceThrottle() { |
| 55 ash::Shell::GetInstance()->activation_client()->AddObserver(this); | 55 ash::Shell::GetInstance()->activation_client()->AddObserver(this); |
| 56 ThrottleInstanceIfNeeded(ash::WmShell::Get()->GetActiveWindow()); | 56 ThrottleInstanceIfNeeded(ash::WmWindow::Get(ash::wm::GetActiveWindow())); |
| 57 } | 57 } |
| 58 | 58 |
| 59 ArcInstanceThrottle::~ArcInstanceThrottle() { | 59 ArcInstanceThrottle::~ArcInstanceThrottle() { |
| 60 if (ash::Shell::HasInstance()) | 60 if (ash::Shell::HasInstance()) |
| 61 ash::Shell::GetInstance()->activation_client()->RemoveObserver(this); | 61 ash::Shell::GetInstance()->activation_client()->RemoveObserver(this); |
| 62 } | 62 } |
| 63 | 63 |
| 64 void ArcInstanceThrottle::OnWindowActivated(ActivationReason reason, | 64 void ArcInstanceThrottle::OnWindowActivated(ActivationReason reason, |
| 65 aura::Window* gained_active, | 65 aura::Window* gained_active, |
| 66 aura::Window* lost_active) { | 66 aura::Window* lost_active) { |
| 67 ThrottleInstanceIfNeeded(ash::WmWindow::Get(gained_active)); | 67 ThrottleInstanceIfNeeded(ash::WmWindow::Get(gained_active)); |
| 68 } | 68 } |
| 69 | 69 |
| 70 } // namespace arc | 70 } // namespace arc |
| OLD | NEW |