Chromium Code Reviews| 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 af1104cdf3801de910000e8e60d06eb14a1d5307..9660bda61d5869e19ad5ea3c67d433f6f796bca8 100644 |
| --- a/chrome/browser/ui/app_list/arc/arc_app_utils.cc |
| +++ b/chrome/browser/ui/app_list/arc/arc_app_utils.cc |
| @@ -22,6 +22,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" |
| @@ -267,48 +268,52 @@ bool LaunchApp(content::BrowserContext* context, |
| std::unique_ptr<ArcAppListPrefs::AppInfo> app_info = prefs->GetApp(app_id); |
| if (app_info && !app_info->ready) { |
| Profile* profile = Profile::FromBrowserContext(context); |
| - bool play_store_activated = false; |
| - if (!IsArcPlayStoreEnabledForProfile(profile)) { |
| - if (!prefs->IsDefault(app_id)) { |
| - NOTREACHED(); |
| - return false; |
| - } |
| - SetArcPlayStoreEnabledForProfile(profile, true); |
| - if (!IsArcPlayStoreEnabledForProfile(profile)) { |
| - NOTREACHED(); |
| - return false; |
| + if (!IsArcPlayStoreEnabledForProfile(profile)) { |
| + if (prefs->IsDefault(app_id)) { |
| + SetArcPlayStoreEnabledForProfile(profile, true); |
| + if (!IsArcPlayStoreEnabledForProfile(profile)) { |
|
Luis Héctor Chávez
2017/03/01 22:25:39
This is the same condition as L272, so this will a
victorhsieh
2017/03/02 00:28:12
No, the previous line switches it. I don't know w
|
| + 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 Google Play |
| + // Store. |
| + if (app_id == kPlayStoreAppId) { |
| + prefs->SetLastLaunchTime(app_id, base::Time::Now()); |
| + return true; |
| + } |
| + } else { |
| + if (!arc::ShouldArcAlwaysStart()) { |
| + NOTREACHED(); |
| + return false; |
| + } |
| } |
| - play_store_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 Google Play Store. |
| - if (!play_store_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(); |