Index: chrome/browser/ui/app_list/arc/arc_app_utils.cc |
diff --git a/chrome/browser/ui/app_list/arc/arc_app_utils.cc b/chrome/browser/ui/app_list/arc/arc_app_utils.cc |
index 188178440bb0e7a94ab85d7a1372dab6a179beff..823afb595103ed4ae49bf15b82555abce0f8bf16 100644 |
--- a/chrome/browser/ui/app_list/arc/arc_app_utils.cc |
+++ b/chrome/browser/ui/app_list/arc/arc_app_utils.cc |
@@ -21,6 +21,7 @@ |
#include "chromeos/dbus/session_manager_client.h" |
#include "components/arc/arc_bridge_service.h" |
#include "components/arc/arc_service_manager.h" |
+#include "components/arc/arc_util.h" |
#include "components/arc/common/intent_helper.mojom.h" |
#include "ui/aura/window.h" |
#include "ui/display/display.h" |
@@ -268,48 +269,51 @@ bool LaunchApp(content::BrowserContext* context, |
ArcSessionManager* arc_session_manager = ArcSessionManager::Get(); |
DCHECK(arc_session_manager); |
- bool arc_activated = false; |
if (!arc_session_manager->IsArcPlayStoreEnabled()) { |
- if (!prefs->IsDefault(app_id)) { |
- NOTREACHED(); |
- return false; |
+ if (prefs->IsDefault(app_id)) { |
+ arc_session_manager->SetArcPlayStoreEnabled(true); |
+ if (!arc_session_manager->IsArcPlayStoreEnabled()) { |
+ NOTREACHED(); |
+ return false; |
+ } |
+ |
+ // PlayStore item has special handling for shelf controllers. In order |
+ // to avoid unwanted initial animation for PlayStore item do not create |
+ // deferred launch request when PlayStore item enables ARC. |
+ if (app_id == kPlayStoreAppId) { |
+ prefs->SetLastLaunchTime(app_id, base::Time::Now()); |
+ return true; |
+ } |
+ } else { |
+ if (!arc::ShouldArcAlwaysStart()) { |
+ NOTREACHED(); |
+ return false; |
+ } |
} |
- |
- arc_session_manager->SetArcPlayStoreEnabled(true); |
- if (!arc_session_manager->IsArcPlayStoreEnabled()) { |
- NOTREACHED(); |
- return false; |
- } |
- arc_activated = true; |
} |
- // PlayStore item has special handling for shelf controllers. In order to |
- // avoid unwanted initial animation for PlayStore item do not create |
- // deferred launch request when PlayStore item enables ARC. |
- if (!arc_activated || app_id != kPlayStoreAppId) { |
- ChromeLauncherController* chrome_controller = |
- ChromeLauncherController::instance(); |
- DCHECK(chrome_controller || !ash::Shell::HasInstance()); |
- if (chrome_controller) { |
- chrome_controller->GetArcDeferredLauncher()->RegisterDeferredLaunch( |
- app_id, event_flags); |
- |
- // On some boards, ARC is booted with a restricted set of resources by |
- // default to avoid slowing down Chrome's user session restoration. |
- // However, the restriction should be lifted once the user explicitly |
- // tries to launch an ARC app. |
- VLOG(2) << "Prioritizing the instance"; |
- chromeos::SessionManagerClient* session_manager_client = |
- chromeos::DBusThreadManager::Get()->GetSessionManagerClient(); |
- session_manager_client->SetArcCpuRestriction( |
- login_manager::CONTAINER_CPU_RESTRICTION_FOREGROUND, |
- base::Bind(SetArcCpuRestrictionCallback)); |
- } |
+ ChromeLauncherController* chrome_controller = |
+ ChromeLauncherController::instance(); |
+ DCHECK(chrome_controller || !ash::Shell::HasInstance()); |
+ if (chrome_controller) { |
+ chrome_controller->GetArcDeferredLauncher()->RegisterDeferredLaunch( |
+ app_id, event_flags); |
+ |
+ // On some boards, ARC is booted with a restricted set of resources by |
+ // default to avoid slowing down Chrome's user session restoration. |
+ // However, the restriction should be lifted once the user explicitly |
+ // tries to launch an ARC app. |
+ VLOG(2) << "Prioritizing the instance"; |
+ chromeos::SessionManagerClient* session_manager_client = |
+ chromeos::DBusThreadManager::Get()->GetSessionManagerClient(); |
+ session_manager_client->SetArcCpuRestriction( |
+ login_manager::CONTAINER_CPU_RESTRICTION_FOREGROUND, |
+ base::Bind(SetArcCpuRestrictionCallback)); |
} |
+ |
prefs->SetLastLaunchTime(app_id, base::Time::Now()); |
return true; |
} |
- |
return (new LaunchAppWithoutSize(context, app_id, landscape_layout, |
event_flags)) |
->LaunchAndRelease(); |