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..778c5860904ccc50a7936088200a9804ffbfd2e5 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,49 @@ 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); |
| + // When managed, writting to the preference may be blocked. In reality, |
| + // other logics prevent us from reaching here in that case. |
|
stevenjb
2017/03/03 18:59:06
I'm not sure I follow. Isn't managed part of 'real
victorhsieh
2017/03/03 19:04:18
IIUC, this code is never called because other code
stevenjb
2017/03/03 20:00:10
If that is true, great, it just wasn't entirely cl
victorhsieh
2017/03/03 20:42:46
Re-worded. Hopefully it's more clear.
|
| + DCHECK(IsArcPlayStoreEnabledForProfile(profile)); |
| + |
| + // 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 { |
| + // Only reachable when ARC always starts. |
| + DCHECK(arc::ShouldArcAlwaysStart()); |
| } |
| - 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(); |