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 "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/synchronization/waitable_event.h" | 9 #include "base/synchronization/waitable_event.h" |
10 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" | 10 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" |
11 #include "components/arc/arc_bridge_service.h" | 11 #include "components/arc/arc_bridge_service.h" |
12 #include "ui/aura/window.h" | 12 #include "ui/aura/window.h" |
13 #include "ui/gfx/display.h" | 13 #include "ui/display/display.h" |
14 #include "ui/gfx/screen.h" | 14 #include "ui/display/screen.h" |
15 | 15 |
16 namespace arc { | 16 namespace arc { |
17 | 17 |
18 namespace { | 18 namespace { |
19 | 19 |
20 // A class which handles the asynchronous ARC runtime callback to figure out if | 20 // A class which handles the asynchronous ARC runtime callback to figure out if |
21 // an app can handle a certain resolution or not. | 21 // an app can handle a certain resolution or not. |
22 // After LaunchAndRelease() got called, the object will destroy itself once | 22 // After LaunchAndRelease() got called, the object will destroy itself once |
23 // done. | 23 // done. |
24 class LaunchAppWithoutSize { | 24 class LaunchAppWithoutSize { |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 // Find a proper size and position for a given rectangle on the screen. | 75 // Find a proper size and position for a given rectangle on the screen. |
76 // TODO(skuhne): This needs more consideration, but it is lacking | 76 // TODO(skuhne): This needs more consideration, but it is lacking |
77 // WindowPositioner functionality since we do not have an Aura::Window yet. | 77 // WindowPositioner functionality since we do not have an Aura::Window yet. |
78 gfx::Rect getTargetRect(const gfx::Size& size) { | 78 gfx::Rect getTargetRect(const gfx::Size& size) { |
79 // Make sure that the window will fit into our workspace. | 79 // Make sure that the window will fit into our workspace. |
80 // Note that Arc++ will always be on the primary screen (for now). | 80 // Note that Arc++ will always be on the primary screen (for now). |
81 // Note that Android's coordinate system is only valid inside the working | 81 // Note that Android's coordinate system is only valid inside the working |
82 // area. We can therefore ignore the provided left / top offsets. | 82 // area. We can therefore ignore the provided left / top offsets. |
83 aura::Window* root = ash::Shell::GetPrimaryRootWindow(); | 83 aura::Window* root = ash::Shell::GetPrimaryRootWindow(); |
84 gfx::Rect work_area = | 84 gfx::Rect work_area = |
85 gfx::Screen::GetScreen()->GetDisplayNearestWindow(root).work_area(); | 85 display::Screen::GetScreen()->GetDisplayNearestWindow(root).work_area(); |
86 | 86 |
87 // For what Android is concerned, the title bar starts at -TITLE_BAR_HEIGHT. | 87 // For what Android is concerned, the title bar starts at -TITLE_BAR_HEIGHT. |
88 // as such we deduct the title bar height simply from the height, but leave | 88 // as such we deduct the title bar height simply from the height, but leave |
89 // the top as it is. | 89 // the top as it is. |
90 work_area.set_height(work_area.height() - WINDOW_TITLE_HEIGHT); | 90 work_area.set_height(work_area.height() - WINDOW_TITLE_HEIGHT); |
91 gfx::Rect result(size); | 91 gfx::Rect result(size); |
92 | 92 |
93 // Make sure that the window fits entirely into the work area. | 93 // Make sure that the window fits entirely into the work area. |
94 if (size.width() < work_area.width() || | 94 if (size.width() < work_area.width() || |
95 size.height() < work_area.height()) { | 95 size.height() < work_area.height()) { |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 | 237 |
238 if (bridge_service->app_version() < 2) { | 238 if (bridge_service->app_version() < 2) { |
239 LOG(ERROR) << "Request to uninstall package when version " | 239 LOG(ERROR) << "Request to uninstall package when version " |
240 << bridge_service->app_version() << " does not support it"; | 240 << bridge_service->app_version() << " does not support it"; |
241 return; | 241 return; |
242 } | 242 } |
243 app_instance->UninstallPackage(package_name); | 243 app_instance->UninstallPackage(package_name); |
244 } | 244 } |
245 | 245 |
246 } // namespace arc | 246 } // namespace arc |
OLD | NEW |