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

Unified Diff: chrome/browser/chromeos/arc/arc_session_manager.cc

Issue 2648213004: Migrate --enable-arc and --arc-available part 1. (Closed)
Patch Set: address comments. Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/arc/arc_session_manager.cc
diff --git a/chrome/browser/chromeos/arc/arc_session_manager.cc b/chrome/browser/chromeos/arc/arc_session_manager.cc
index 4858e187b06495dc36b4f14436338ec23116974e..fdc74180993d965389de64eca4a8f0869cec6be3 100644
--- a/chrome/browser/chromeos/arc/arc_session_manager.cc
+++ b/chrome/browser/chromeos/arc/arc_session_manager.cc
@@ -43,6 +43,7 @@
#include "chromeos/dbus/session_manager_client.h"
#include "components/arc/arc_bridge_service.h"
#include "components/arc/arc_session_runner.h"
+#include "components/arc/arc_util.h"
#include "components/pref_registry/pref_registry_syncable.h"
#include "components/prefs/pref_service.h"
#include "components/sync_preferences/pref_service_syncable.h"
@@ -67,6 +68,9 @@ ash::ShelfDelegate* g_shelf_delegate_for_testing = nullptr;
// testing.
bool g_enable_check_android_management_for_testing = false;
+// Let IsAllowedForProfile() return "false" for any profile.
+bool g_disallow_for_testing = false;
+
// Maximum amount of time we'll wait for ARC to finish booting up. Once this
// timeout expires, keep ARC running in case the user wants to file feedback,
// but present the UI to try again.
@@ -148,8 +152,13 @@ void ArcSessionManager::EnableCheckAndroidManagementForTesting() {
// static
bool ArcSessionManager::IsAllowedForProfile(const Profile* profile) {
- if (!ArcBridgeService::GetEnabled(base::CommandLine::ForCurrentProcess())) {
- VLOG(1) << "Arc is not enabled.";
+ if (g_disallow_for_testing) {
+ VLOG(1) << "ARC is disallowed for testing.";
+ return false;
+ }
+
+ if (!IsArcAvailable()) {
+ VLOG(1) << "ARC is not available.";
return false;
}
@@ -191,7 +200,7 @@ bool ArcSessionManager::IsAllowedForProfile(const Profile* profile) {
if (user_manager::UserManager::Get()
->IsCurrentUserCryptohomeDataEphemeral()) {
- VLOG(2) << "Users with ephemeral data are not supported in Arc.";
+ VLOG(2) << "Users with ephemeral data are not supported in ARC.";
return false;
}
@@ -199,6 +208,11 @@ bool ArcSessionManager::IsAllowedForProfile(const Profile* profile) {
}
// static
+void ArcSessionManager::DisallowForTesting() {
+ g_disallow_for_testing = true;
+}
+
+// static
bool ArcSessionManager::IsArcKioskMode() {
return user_manager::UserManager::Get()->IsLoggedInAsArcKioskApp();
}
« no previous file with comments | « chrome/browser/chromeos/arc/arc_session_manager.h ('k') | chrome/browser/chromeos/arc/arc_session_manager_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698