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

Side by Side Diff: chrome/browser/ui/app_list/arc/arc_app_utils.cc

Issue 2282023002: arc: Support window recreation. (Closed)
Patch Set: rebase + nits Created 4 years, 3 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
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 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 <string> 7 #include <string>
8 8
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 14 matching lines...) Expand all
25 constexpr int kNexus7Width = 960; 25 constexpr int kNexus7Width = 960;
26 constexpr int kNexus7Height = 600; 26 constexpr int kNexus7Height = 600;
27 constexpr int kNexus5Width = 410; 27 constexpr int kNexus5Width = 410;
28 constexpr int kNexus5Height = 690; 28 constexpr int kNexus5Height = 690;
29 29
30 // Minimum required versions. 30 // Minimum required versions.
31 constexpr int kMinVersion = 0; 31 constexpr int kMinVersion = 0;
32 constexpr int kCanHandleResolutionMinVersion = 1; 32 constexpr int kCanHandleResolutionMinVersion = 1;
33 constexpr int kSendBroadcastMinVersion = 1; 33 constexpr int kSendBroadcastMinVersion = 1;
34 constexpr int kUninstallPackageMinVersion = 2; 34 constexpr int kUninstallPackageMinVersion = 2;
35 constexpr int kTaskSupportMinVersion = 3;
35 constexpr int kShowPackageInfoMinVersion = 5; 36 constexpr int kShowPackageInfoMinVersion = 5;
36 constexpr int kRemoveIconMinVersion = 9; 37 constexpr int kRemoveIconMinVersion = 9;
37 constexpr int kShowPackageInfoOnPageMinVersion = 10; 38 constexpr int kShowPackageInfoOnPageMinVersion = 10;
38 39
39 // Service name strings. 40 // Service name strings.
40 constexpr char kCanHandleResolutionStr[] = "get resolution capability"; 41 constexpr char kCanHandleResolutionStr[] = "get resolution capability";
42 constexpr char kCloseTaskStr[] = "close task";
41 constexpr char kLaunchAppStr[] = "launch app"; 43 constexpr char kLaunchAppStr[] = "launch app";
44 constexpr char kRemoveIconStr[] = "remove icon";
45 constexpr char kSetActiveTaskStr[] = "set active task";
42 constexpr char kShowPackageInfoStr[] = "show package info"; 46 constexpr char kShowPackageInfoStr[] = "show package info";
43 constexpr char kUninstallPackageStr[] = "uninstall package"; 47 constexpr char kUninstallPackageStr[] = "uninstall package";
44 constexpr char kRemoveIconStr[] = "remove icon";
45 48
46 // Helper function which returns the AppInstance. Create related logs when error 49 // Helper function which returns the AppInstance. Create related logs when error
47 // happens. 50 // happens.
48 arc::mojom::AppInstance* GetAppInstance(int required_version, 51 arc::mojom::AppInstance* GetAppInstance(int required_version,
49 const std::string& service_name) { 52 const std::string& service_name) {
50 arc::ArcBridgeService* bridge_service = arc::ArcBridgeService::Get(); 53 arc::ArcBridgeService* bridge_service = arc::ArcBridgeService::Get();
51 if (!bridge_service) { 54 if (!bridge_service) {
52 VLOG(2) << "Request to " << service_name 55 VLOG(2) << "Request to " << service_name
53 << " when bridge service is not ready."; 56 << " when bridge service is not ready.";
54 return nullptr; 57 return nullptr;
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 ChromeLauncherController::instance(); 229 ChromeLauncherController::instance();
227 DCHECK(chrome_controller); 230 DCHECK(chrome_controller);
228 chrome_controller->GetArcDeferredLauncher()->RegisterDeferredLaunch(app_id); 231 chrome_controller->GetArcDeferredLauncher()->RegisterDeferredLaunch(app_id);
229 return true; 232 return true;
230 } 233 }
231 234
232 return (new LaunchAppWithoutSize(context, app_id, landscape_layout)) 235 return (new LaunchAppWithoutSize(context, app_id, landscape_layout))
233 ->LaunchAndRelease(); 236 ->LaunchAndRelease();
234 } 237 }
235 238
239 void SetTaskActive(int task_id) {
240 arc::mojom::AppInstance* app_instance =
241 GetAppInstance(kTaskSupportMinVersion, kSetActiveTaskStr);
242 if (!app_instance)
243 return;
244 app_instance->SetTaskActive(task_id);
245 }
246
247 void CloseTask(int task_id) {
248 arc::mojom::AppInstance* app_instance =
249 GetAppInstance(kTaskSupportMinVersion, kCloseTaskStr);
250 if (!app_instance)
251 return;
252 app_instance->CloseTask(task_id);
253 }
254
236 void ShowTalkBackSettings() { 255 void ShowTalkBackSettings() {
237 arc::ArcBridgeService* bridge_service = arc::ArcBridgeService::Get(); 256 arc::ArcBridgeService* bridge_service = arc::ArcBridgeService::Get();
238 if (!bridge_service) { 257 if (!bridge_service) {
239 VLOG(2) << "ARC bridge is not ready"; 258 VLOG(2) << "ARC bridge is not ready";
240 return; 259 return;
241 } 260 }
242 261
243 arc::mojom::IntentHelperInstance *intent_helper_instance = 262 arc::mojom::IntentHelperInstance *intent_helper_instance =
244 bridge_service->intent_helper()->instance(); 263 bridge_service->intent_helper()->instance();
245 if (!intent_helper_instance) { 264 if (!intent_helper_instance) {
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 if (!app_instance) 345 if (!app_instance)
327 return false; 346 return false;
328 347
329 app_instance->ShowPackageInfoOnPage( 348 app_instance->ShowPackageInfoOnPage(
330 package_name, page, 349 package_name, page,
331 GetTargetRect(gfx::Size(kNexus7Width, kNexus7Height))); 350 GetTargetRect(gfx::Size(kNexus7Width, kNexus7Height)));
332 return true; 351 return true;
333 } 352 }
334 353
335 } // namespace arc 354 } // namespace arc
OLDNEW
« no previous file with comments | « chrome/browser/ui/app_list/arc/arc_app_utils.h ('k') | chrome/browser/ui/ash/launcher/app_window_launcher_item_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698