hidehiko | aab3dea | 2017-01-30 14:36:46 | [diff] [blame] | 1 | // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef COMPONENTS_ARC_ARC_UTIL_H_ |
| 6 | #define COMPONENTS_ARC_ARC_UTIL_H_ |
| 7 | |
| 8 | // This file contains utility to see ARC functionality status controlled by |
| 9 | // outside of ARC, e.g. CommandLine flag, attribute of global data/state, |
| 10 | // users' preferences, and FeatureList. |
| 11 | |
yusukes | 5f38c3cd | 2017-05-17 03:56:55 | [diff] [blame^] | 12 | namespace aura { |
| 13 | class Window; |
| 14 | } // namespace aura |
| 15 | |
hidehiko | aab3dea | 2017-01-30 14:36:46 | [diff] [blame] | 16 | namespace base { |
| 17 | class CommandLine; |
| 18 | } // namespace base |
| 19 | |
| 20 | namespace arc { |
| 21 | |
| 22 | // Returns true if ARC is installed and the current device is officially |
| 23 | // supported to run ARC. |
| 24 | // Note that, to run ARC practically, it is necessary to meet more conditions, |
| 25 | // e.g., ARC supports only on Primary User Profile. To see if ARC can actually |
| 26 | // run for the profile etc., arc::ArcSessionManager::IsAllowedForProfile() is |
| 27 | // the function for that purpose. Please see also its comment, too. |
| 28 | // Also note that, ARC singleton classes (e.g. ArcSessionManager, |
| 29 | // ArcServiceManager, ArcServiceLauncher) are instantiated regardless of this |
| 30 | // check, so it is ok to access them directly. |
| 31 | bool IsArcAvailable(); |
| 32 | |
victorhsieh | ec70785 | 2017-03-07 19:37:06 | [diff] [blame] | 33 | // Returns true if ARC should always start within the primary user session |
| 34 | // (opted in user or not), and other supported mode such as guest and Kiosk |
| 35 | // mode. |
| 36 | bool ShouldArcAlwaysStart(); |
| 37 | |
| 38 | // Enables to always start ARC for testing, by appending the command line flag. |
| 39 | void SetArcAlwaysStartForTesting(); |
| 40 | |
poromov | 4fdd067 | 2017-02-09 17:30:02 | [diff] [blame] | 41 | // Returns true if ARC is installed and running ARC kiosk apps on the current |
| 42 | // device is officially supported. |
| 43 | // It doesn't follow that ARC is available for user sessions and |
| 44 | // IsArcAvailable() will return true, although the reverse should be. |
| 45 | // This is used to distinguish special cases when ARC kiosk is available on |
| 46 | // the device, but is not yet supported for regular user sessions. |
| 47 | // In most cases, IsArcAvailable() check should be used instead of this. |
| 48 | // Also not that this function may return true when ARC is not running in |
| 49 | // Kiosk mode, it checks only ARC Kiosk availability. |
| 50 | bool IsArcKioskAvailable(); |
| 51 | |
hidehiko | aab3dea | 2017-01-30 14:36:46 | [diff] [blame] | 52 | // For testing ARC in browser tests, this function should be called in |
| 53 | // SetUpCommandLine(), and its argument should be passed to this function. |
| 54 | // Also, in unittests, this can be called in SetUp() with |
| 55 | // base::CommandLine::ForCurrentProcess(). |
| 56 | // |command_line| must not be nullptr. |
| 57 | void SetArcAvailableCommandLineForTesting(base::CommandLine* command_line); |
| 58 | |
poromov | 4fdd067 | 2017-02-09 17:30:02 | [diff] [blame] | 59 | // Returns true if ARC should run under Kiosk mode for the current profile. |
| 60 | // As it can return true only when user is already initialized, it implies |
| 61 | // that ARC availability was checked before and IsArcKioskAvailable() |
| 62 | // should also return true in that case. |
hidehiko | 0b75bce6 | 2017-01-31 13:13:01 | [diff] [blame] | 63 | bool IsArcKioskMode(); |
| 64 | |
hunyadym | 56c49db6 | 2017-02-07 18:57:42 | [diff] [blame] | 65 | // Returns true if it is allowed to use ARC with Active Directory managed |
| 66 | // devices. |
| 67 | bool IsArcAllowedForActiveDirectoryUsers(); |
| 68 | |
hidehiko | 0b75bce6 | 2017-01-31 13:13:01 | [diff] [blame] | 69 | // Checks if opt-in verification was disabled by switch in command line. |
| 70 | // In most cases, it is disabled for testing purpose. |
| 71 | bool IsArcOptInVerificationDisabled(); |
| 72 | |
yusukes | 5f38c3cd | 2017-05-17 03:56:55 | [diff] [blame^] | 73 | // Returns true if the |window|'s aura::client::kAppType is ARC_APP. When |
| 74 | // |window| is nullptr, returns false. |
| 75 | bool IsArcAppWindow(aura::Window* window); |
| 76 | |
hidehiko | aab3dea | 2017-01-30 14:36:46 | [diff] [blame] | 77 | } // namespace arc |
| 78 | |
| 79 | #endif // COMPONENTS_ARC_ARC_UTIL_H_ |