| 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 | 4 |
| 5 #include "chrome/browser/ui/app_list/arc/arc_app_utils.h" | 5 #include "chrome/browser/ui/app_list/arc/arc_app_utils.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 VLOG(2) << "Finished prioritizing the instance: result=" << success; | 67 VLOG(2) << "Finished prioritizing the instance: result=" << success; |
| 68 if (!success) | 68 if (!success) |
| 69 LOG(ERROR) << "Failed to prioritize ARC"; | 69 LOG(ERROR) << "Failed to prioritize ARC"; |
| 70 } | 70 } |
| 71 | 71 |
| 72 // Find a proper size and position for a given rectangle on the screen. | 72 // Find a proper size and position for a given rectangle on the screen. |
| 73 // TODO(skuhne): This needs more consideration, but it is lacking | 73 // TODO(skuhne): This needs more consideration, but it is lacking |
| 74 // WindowPositioner functionality since we do not have an Aura::Window yet. | 74 // WindowPositioner functionality since we do not have an Aura::Window yet. |
| 75 gfx::Rect GetTargetRect(const gfx::Size& size) { | 75 gfx::Rect GetTargetRect(const gfx::Size& size) { |
| 76 // Make sure that the window will fit into our workspace. | 76 // Make sure that the window will fit into our workspace. |
| 77 // Note that Arc++ will always be on the primary screen (for now). | 77 // Note that ARC will always be on the primary screen (for now). |
| 78 // Note that Android's coordinate system is only valid inside the working | 78 // Note that Android's coordinate system is only valid inside the working |
| 79 // area. We can therefore ignore the provided left / top offsets. | 79 // area. We can therefore ignore the provided left / top offsets. |
| 80 aura::Window* root = ash::Shell::GetPrimaryRootWindow(); | 80 aura::Window* root = ash::Shell::GetPrimaryRootWindow(); |
| 81 gfx::Rect work_area = | 81 gfx::Rect work_area = |
| 82 display::Screen::GetScreen()->GetDisplayNearestWindow(root).work_area(); | 82 display::Screen::GetScreen()->GetDisplayNearestWindow(root).work_area(); |
| 83 | 83 |
| 84 gfx::Rect result(size); | 84 gfx::Rect result(size); |
| 85 | 85 |
| 86 // We do not adjust sizes to fit the window into the work area here. | 86 // We do not adjust sizes to fit the window into the work area here. |
| 87 // The reason is that the used DP<->pix transformation is different on | 87 // The reason is that the used DP<->pix transformation is different on |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 arc_session_manager->SetArcPlayStoreEnabled(true); | 278 arc_session_manager->SetArcPlayStoreEnabled(true); |
| 279 if (!arc_session_manager->IsArcPlayStoreEnabled()) { | 279 if (!arc_session_manager->IsArcPlayStoreEnabled()) { |
| 280 NOTREACHED(); | 280 NOTREACHED(); |
| 281 return false; | 281 return false; |
| 282 } | 282 } |
| 283 arc_activated = true; | 283 arc_activated = true; |
| 284 } | 284 } |
| 285 | 285 |
| 286 // PlayStore item has special handling for shelf controllers. In order to | 286 // PlayStore item has special handling for shelf controllers. In order to |
| 287 // avoid unwanted initial animation for PlayStore item do not create | 287 // avoid unwanted initial animation for PlayStore item do not create |
| 288 // deferred launch request when PlayStore item enables Arc. | 288 // deferred launch request when PlayStore item enables ARC. |
| 289 if (!arc_activated || app_id != kPlayStoreAppId) { | 289 if (!arc_activated || app_id != kPlayStoreAppId) { |
| 290 ChromeLauncherController* chrome_controller = | 290 ChromeLauncherController* chrome_controller = |
| 291 ChromeLauncherController::instance(); | 291 ChromeLauncherController::instance(); |
| 292 DCHECK(chrome_controller || !ash::Shell::HasInstance()); | 292 DCHECK(chrome_controller || !ash::Shell::HasInstance()); |
| 293 if (chrome_controller) { | 293 if (chrome_controller) { |
| 294 chrome_controller->GetArcDeferredLauncher()->RegisterDeferredLaunch( | 294 chrome_controller->GetArcDeferredLauncher()->RegisterDeferredLaunch( |
| 295 app_id, event_flags); | 295 app_id, event_flags); |
| 296 | 296 |
| 297 // On some boards, ARC is booted with a restricted set of resources by | 297 // On some boards, ARC is booted with a restricted set of resources by |
| 298 // default to avoid slowing down Chrome's user session restoration. | 298 // default to avoid slowing down Chrome's user session restoration. |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 return false; | 435 return false; |
| 436 | 436 |
| 437 const ArcAppListPrefs* const arc_prefs = ArcAppListPrefs::Get(context); | 437 const ArcAppListPrefs* const arc_prefs = ArcAppListPrefs::Get(context); |
| 438 if (!arc_prefs) | 438 if (!arc_prefs) |
| 439 return false; | 439 return false; |
| 440 | 440 |
| 441 return arc_prefs->IsRegistered(ArcAppShelfId::FromString(id).app_id()); | 441 return arc_prefs->IsRegistered(ArcAppShelfId::FromString(id).app_id()); |
| 442 } | 442 } |
| 443 | 443 |
| 444 } // namespace arc | 444 } // namespace arc |
| OLD | NEW |