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

Side by Side Diff: chromeos/dbus/dbus_client_types.cc

Issue 2350543002: chromeos; Remove unused switch --dbus-unstub-clients / --dbus-real-clients (Closed)
Patch Set: rebase again Created 4 years, 3 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
« no previous file with comments | « chromeos/dbus/dbus_client_types.h ('k') | chromeos/dbus/dbus_clients_browser.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 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 #include "chromeos/dbus/dbus_client_types.h"
6
7 #include "base/macros.h"
8 #include "base/strings/string_split.h"
9 #include "base/strings/string_util.h"
10
11 namespace chromeos {
12
13 namespace {
14
15 // Command line switch mapping for --dbus-real-clients.
16 const struct {
17 const char* param_name;
18 DBusClientType client_type;
19 } kClientTypeMap[] = {
20 {"bluetooth", DBusClientType::BLUETOOTH},
21 {"cras", DBusClientType::CRAS},
22 {"cros_disks", DBusClientType::CROS_DISKS},
23 {"cryptohome", DBusClientType::CRYPTOHOME},
24 {"debug_daemon", DBusClientType::DEBUG_DAEMON},
25 {"easy_unlock", DBusClientType::EASY_UNLOCK},
26 {"lorgnette_manager", DBusClientType::LORGNETTE_MANAGER},
27 {"shill", DBusClientType::SHILL},
28 {"gsm_sms", DBusClientType::GSM_SMS},
29 {"image_burner", DBusClientType::IMAGE_BURNER},
30 {"modem_messaging", DBusClientType::MODEM_MESSAGING},
31 {"permission_broker", DBusClientType::PERMISSION_BROKER},
32 {"power_manager", DBusClientType::POWER_MANAGER},
33 {"session_manager", DBusClientType::SESSION_MANAGER},
34 {"sms", DBusClientType::SMS},
35 {"system_clock", DBusClientType::SYSTEM_CLOCK},
36 {"update_engine", DBusClientType::UPDATE_ENGINE},
37 {"arc_obb_mounter", DBusClientType::ARC_OBB_MOUNTER},
38 };
39
40 // Parses single command line param value for dbus subsystem. If successful,
41 // returns its enum representation. Otherwise returns NONE.
42 DBusClientType GetDBusClientType(const std::string& client_type_name) {
43 for (size_t i = 0; i < arraysize(kClientTypeMap); i++) {
44 if (base::LowerCaseEqualsASCII(client_type_name,
45 kClientTypeMap[i].param_name))
46 return kClientTypeMap[i].client_type;
47 }
48 return DBusClientType::NONE;
49 }
50
51 } // namespace
52
53 DBusClientTypeMask ParseDBusRealClientsList(const std::string& clients_list) {
54 DBusClientTypeMask real_client_mask = 0;
55 for (const std::string& cur : base::SplitString(
56 clients_list, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL)) {
57 DBusClientType client = GetDBusClientType(cur);
58 if (client != DBusClientType::NONE) {
59 LOG(WARNING) << "Forcing real dbus client for " << cur;
60 real_client_mask |= static_cast<int>(client);
61 } else {
62 LOG(ERROR) << "Unknown dbus client: " << cur;
63 }
64 }
65
66 return real_client_mask;
67 }
68
69 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/dbus/dbus_client_types.h ('k') | chromeos/dbus/dbus_clients_browser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698