blob: d27f4389f222d8977885f8e650845d77a9558f50 [file] [log] [blame]
hidehikoaab3dea2017-01-30 14:36:461// 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
yusukes5f38c3cd2017-05-17 03:56:5512namespace aura {
13class Window;
14} // namespace aura
15
hidehikoaab3dea2017-01-30 14:36:4616namespace base {
17class CommandLine;
18} // namespace base
19
xiyuan94a81dea2017-05-25 14:31:0320namespace user_manager {
21class User;
22} // namespace user_manager
23
hidehikoaab3dea2017-01-30 14:36:4624namespace arc {
25
26// Returns true if ARC is installed and the current device is officially
27// supported to run ARC.
28// Note that, to run ARC practically, it is necessary to meet more conditions,
29// e.g., ARC supports only on Primary User Profile. To see if ARC can actually
30// run for the profile etc., arc::ArcSessionManager::IsAllowedForProfile() is
31// the function for that purpose. Please see also its comment, too.
32// Also note that, ARC singleton classes (e.g. ArcSessionManager,
33// ArcServiceManager, ArcServiceLauncher) are instantiated regardless of this
34// check, so it is ok to access them directly.
35bool IsArcAvailable();
36
victorhsiehec707852017-03-07 19:37:0637// Returns true if ARC should always start within the primary user session
38// (opted in user or not), and other supported mode such as guest and Kiosk
39// mode.
40bool ShouldArcAlwaysStart();
41
42// Enables to always start ARC for testing, by appending the command line flag.
43void SetArcAlwaysStartForTesting();
44
poromov4fdd0672017-02-09 17:30:0245// Returns true if ARC is installed and running ARC kiosk apps on the current
46// device is officially supported.
47// It doesn't follow that ARC is available for user sessions and
48// IsArcAvailable() will return true, although the reverse should be.
49// This is used to distinguish special cases when ARC kiosk is available on
50// the device, but is not yet supported for regular user sessions.
51// In most cases, IsArcAvailable() check should be used instead of this.
52// Also not that this function may return true when ARC is not running in
53// Kiosk mode, it checks only ARC Kiosk availability.
54bool IsArcKioskAvailable();
55
hidehikoaab3dea2017-01-30 14:36:4656// For testing ARC in browser tests, this function should be called in
57// SetUpCommandLine(), and its argument should be passed to this function.
58// Also, in unittests, this can be called in SetUp() with
59// base::CommandLine::ForCurrentProcess().
60// |command_line| must not be nullptr.
61void SetArcAvailableCommandLineForTesting(base::CommandLine* command_line);
62
poromov4fdd0672017-02-09 17:30:0263// Returns true if ARC should run under Kiosk mode for the current profile.
64// As it can return true only when user is already initialized, it implies
65// that ARC availability was checked before and IsArcKioskAvailable()
66// should also return true in that case.
hidehiko0b75bce62017-01-31 13:13:0167bool IsArcKioskMode();
68
xiyuan94a81dea2017-05-25 14:31:0369// Returns true if ARC is allowed for the given user. Note this should not be
70// used as a signal of whether ARC is allowed alone because it only considers
71// user meta data. e.g. a user could be allowed for ARC but if the user signs in
72// as a secondary user or signs in to create a supervised user, ARC should be
73// disabled for such cases.
74bool IsArcAllowedForUser(const user_manager::User* user);
75
hidehiko0b75bce62017-01-31 13:13:0176// Checks if opt-in verification was disabled by switch in command line.
77// In most cases, it is disabled for testing purpose.
78bool IsArcOptInVerificationDisabled();
79
yusukes5f38c3cd2017-05-17 03:56:5580// Returns true if the |window|'s aura::client::kAppType is ARC_APP. When
81// |window| is nullptr, returns false.
82bool IsArcAppWindow(aura::Window* window);
83
updowndota29b240a2017-05-25 20:19:1984// Sets CPU restriction for ARC to prioritize the container.
85void PrioritizeArcContainer();
86
hidehikoaab3dea2017-01-30 14:36:4687} // namespace arc
88
89#endif // COMPONENTS_ARC_ARC_UTIL_H_