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

Side by Side Diff: components/arc/arc_util.cc

Issue 2898273002: Move Voice Interaction shortcut to accelerator_controller.cc (Closed)
Patch Set: Refactor Created 3 years, 7 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 unified diff | Download patch
« components/arc/arc_util.h ('K') | « components/arc/arc_util.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/arc/arc_util.h" 5 #include "components/arc/arc_util.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/feature_list.h" 10 #include "base/feature_list.h"
11 #include "chromeos/chromeos_switches.h" 11 #include "chromeos/chromeos_switches.h"
12 #include "chromeos/dbus/dbus_thread_manager.h"
13 #include "chromeos/dbus/session_manager_client.h"
12 #include "components/user_manager/user_manager.h" 14 #include "components/user_manager/user_manager.h"
13 15
14 namespace arc { 16 namespace arc {
15 17
16 namespace { 18 namespace {
17 19
18 // This is for finch. See also crbug.com/633704 for details. 20 // This is for finch. See also crbug.com/633704 for details.
19 // TODO(hidehiko): More comments of the intention how this works, when 21 // TODO(hidehiko): More comments of the intention how this works, when
20 // we unify the commandline flags. 22 // we unify the commandline flags.
21 const base::Feature kEnableArcFeature{"EnableARC", 23 const base::Feature kEnableArcFeature{"EnableARC",
22 base::FEATURE_DISABLED_BY_DEFAULT}; 24 base::FEATURE_DISABLED_BY_DEFAULT};
23 25
24 // Possible values for --arc-availability flag. 26 // Possible values for --arc-availability flag.
25 constexpr char kAvailabilityNone[] = "none"; 27 constexpr char kAvailabilityNone[] = "none";
26 constexpr char kAvailabilityInstalled[] = "installed"; 28 constexpr char kAvailabilityInstalled[] = "installed";
27 constexpr char kAvailabilityOfficiallySupported[] = "officially-supported"; 29 constexpr char kAvailabilityOfficiallySupported[] = "officially-supported";
28 constexpr char kAvailabilityOfficiallySupportedWithActiveDirectory[] = 30 constexpr char kAvailabilityOfficiallySupportedWithActiveDirectory[] =
29 "officially-supported-with-active-directory"; 31 "officially-supported-with-active-directory";
30 32
33 void SetArcCpuRestrictionCallback(bool success) {
34 VLOG(2) << "Finished prioritizing the instance: result=" << success;
35 if (!success)
36 LOG(ERROR) << "Failed to prioritize ARC";
37 }
38
31 } // namespace 39 } // namespace
32 40
33 bool IsArcAvailable() { 41 bool IsArcAvailable() {
34 const auto* command_line = base::CommandLine::ForCurrentProcess(); 42 const auto* command_line = base::CommandLine::ForCurrentProcess();
35 43
36 if (command_line->HasSwitch(chromeos::switches::kArcAvailability)) { 44 if (command_line->HasSwitch(chromeos::switches::kArcAvailability)) {
37 std::string value = command_line->GetSwitchValueASCII( 45 std::string value = command_line->GetSwitchValueASCII(
38 chromeos::switches::kArcAvailability); 46 chromeos::switches::kArcAvailability);
39 DCHECK(value == kAvailabilityNone || 47 DCHECK(value == kAvailabilityNone ||
40 value == kAvailabilityInstalled || 48 value == kAvailabilityInstalled ||
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 chromeos::switches::kArcAvailability) == 112 chromeos::switches::kArcAvailability) ==
105 kAvailabilityOfficiallySupportedWithActiveDirectory; 113 kAvailabilityOfficiallySupportedWithActiveDirectory;
106 } 114 }
107 115
108 bool IsArcOptInVerificationDisabled() { 116 bool IsArcOptInVerificationDisabled() {
109 const auto* command_line = base::CommandLine::ForCurrentProcess(); 117 const auto* command_line = base::CommandLine::ForCurrentProcess();
110 return command_line->HasSwitch( 118 return command_line->HasSwitch(
111 chromeos::switches::kDisableArcOptInVerification); 119 chromeos::switches::kDisableArcOptInVerification);
112 } 120 }
113 121
122 void PrioritizeArcContainerStartup() {
123 VLOG(2) << "Prioritizing the instance";
124 chromeos::SessionManagerClient* session_manager_client =
125 chromeos::DBusThreadManager::Get()->GetSessionManagerClient();
126 session_manager_client->SetArcCpuRestriction(
127 login_manager::CONTAINER_CPU_RESTRICTION_FOREGROUND,
128 base::Bind(SetArcCpuRestrictionCallback));
129 }
130
114 } // namespace arc 131 } // namespace arc
OLDNEW
« components/arc/arc_util.h ('K') | « components/arc/arc_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698