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

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

Issue 2232203003: Implement a dbus client for CupsTool. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "chromeos/dbus/dbus_client_bundle.h" 5 #include "chromeos/dbus/dbus_client_bundle.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/strings/string_split.h" 12 #include "base/strings/string_split.h"
13 #include "base/strings/string_util.h" 13 #include "base/strings/string_util.h"
14 #include "chromeos/chromeos_switches.h" 14 #include "chromeos/chromeos_switches.h"
15 #include "chromeos/dbus/arc_obb_mounter_client.h" 15 #include "chromeos/dbus/arc_obb_mounter_client.h"
16 #include "chromeos/dbus/cras_audio_client.h" 16 #include "chromeos/dbus/cras_audio_client.h"
17 #include "chromeos/dbus/cros_disks_client.h" 17 #include "chromeos/dbus/cros_disks_client.h"
18 #include "chromeos/dbus/cryptohome_client.h" 18 #include "chromeos/dbus/cryptohome_client.h"
19 #include "chromeos/dbus/cups_client.h"
19 #include "chromeos/dbus/debug_daemon_client.h" 20 #include "chromeos/dbus/debug_daemon_client.h"
20 #include "chromeos/dbus/easy_unlock_client.h" 21 #include "chromeos/dbus/easy_unlock_client.h"
21 #include "chromeos/dbus/fake_arc_obb_mounter_client.h" 22 #include "chromeos/dbus/fake_arc_obb_mounter_client.h"
22 #include "chromeos/dbus/fake_cras_audio_client.h" 23 #include "chromeos/dbus/fake_cras_audio_client.h"
23 #include "chromeos/dbus/fake_cryptohome_client.h" 24 #include "chromeos/dbus/fake_cryptohome_client.h"
25 #include "chromeos/dbus/fake_cups_client.h"
24 #include "chromeos/dbus/fake_debug_daemon_client.h" 26 #include "chromeos/dbus/fake_debug_daemon_client.h"
25 #include "chromeos/dbus/fake_easy_unlock_client.h" 27 #include "chromeos/dbus/fake_easy_unlock_client.h"
26 #include "chromeos/dbus/fake_gsm_sms_client.h" 28 #include "chromeos/dbus/fake_gsm_sms_client.h"
27 #include "chromeos/dbus/fake_image_burner_client.h" 29 #include "chromeos/dbus/fake_image_burner_client.h"
28 #include "chromeos/dbus/fake_lorgnette_manager_client.h" 30 #include "chromeos/dbus/fake_lorgnette_manager_client.h"
29 #include "chromeos/dbus/fake_modem_messaging_client.h" 31 #include "chromeos/dbus/fake_modem_messaging_client.h"
30 #include "chromeos/dbus/fake_permission_broker_client.h" 32 #include "chromeos/dbus/fake_permission_broker_client.h"
31 #include "chromeos/dbus/fake_shill_device_client.h" 33 #include "chromeos/dbus/fake_shill_device_client.h"
32 #include "chromeos/dbus/fake_shill_ipconfig_client.h" 34 #include "chromeos/dbus/fake_shill_ipconfig_client.h"
33 #include "chromeos/dbus/fake_shill_manager_client.h" 35 #include "chromeos/dbus/fake_shill_manager_client.h"
(...skipping 25 matching lines...) Expand all
59 namespace { 61 namespace {
60 62
61 // Command line switch mapping for --dbus-unstub-clients. 63 // Command line switch mapping for --dbus-unstub-clients.
62 const struct { 64 const struct {
63 const char* param_name; 65 const char* param_name;
64 DBusClientBundle::DBusClientType client_type; 66 DBusClientBundle::DBusClientType client_type;
65 } client_type_map[] = { 67 } client_type_map[] = {
66 { "bluetooth", DBusClientBundle::BLUETOOTH }, 68 { "bluetooth", DBusClientBundle::BLUETOOTH },
67 { "cras", DBusClientBundle::CRAS }, 69 { "cras", DBusClientBundle::CRAS },
68 { "cros_disks", DBusClientBundle::CROS_DISKS }, 70 { "cros_disks", DBusClientBundle::CROS_DISKS },
71 { "cups_client", DBusClientBundle::CUPS_CLIENT},
69 { "cryptohome", DBusClientBundle::CRYPTOHOME }, 72 { "cryptohome", DBusClientBundle::CRYPTOHOME },
70 { "debug_daemon", DBusClientBundle::DEBUG_DAEMON }, 73 { "debug_daemon", DBusClientBundle::DEBUG_DAEMON },
71 { "easy_unlock", DBusClientBundle::EASY_UNLOCK }, 74 { "easy_unlock", DBusClientBundle::EASY_UNLOCK },
72 { "lorgnette_manager", DBusClientBundle::LORGNETTE_MANAGER }, 75 { "lorgnette_manager", DBusClientBundle::LORGNETTE_MANAGER },
73 { "shill", DBusClientBundle::SHILL }, 76 { "shill", DBusClientBundle::SHILL },
74 { "gsm_sms", DBusClientBundle::GSM_SMS }, 77 { "gsm_sms", DBusClientBundle::GSM_SMS },
75 { "image_burner", DBusClientBundle::IMAGE_BURNER }, 78 { "image_burner", DBusClientBundle::IMAGE_BURNER },
76 { "modem_messaging", DBusClientBundle::MODEM_MESSAGING }, 79 { "modem_messaging", DBusClientBundle::MODEM_MESSAGING },
77 { "permission_broker", DBusClientBundle::PERMISSION_BROKER }, 80 { "permission_broker", DBusClientBundle::PERMISSION_BROKER },
78 { "power_manager", DBusClientBundle::POWER_MANAGER }, 81 { "power_manager", DBusClientBundle::POWER_MANAGER },
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 113
111 cros_disks_client_.reset(CrosDisksClient::Create( 114 cros_disks_client_.reset(CrosDisksClient::Create(
112 IsUsingStub(CROS_DISKS) ? STUB_DBUS_CLIENT_IMPLEMENTATION 115 IsUsingStub(CROS_DISKS) ? STUB_DBUS_CLIENT_IMPLEMENTATION
113 : REAL_DBUS_CLIENT_IMPLEMENTATION)); 116 : REAL_DBUS_CLIENT_IMPLEMENTATION));
114 117
115 if (!IsUsingStub(CRYPTOHOME)) 118 if (!IsUsingStub(CRYPTOHOME))
116 cryptohome_client_.reset(CryptohomeClient::Create()); 119 cryptohome_client_.reset(CryptohomeClient::Create());
117 else 120 else
118 cryptohome_client_.reset(new FakeCryptohomeClient); 121 cryptohome_client_.reset(new FakeCryptohomeClient);
119 122
123 if (!IsUsingStub(CUPS_CLIENT))
124 cups_client_.reset(CupsClient::Create());
125 else
126 cups_client_.reset(new FakeCupsClient);
127
120 if (!IsUsingStub(DEBUG_DAEMON)) 128 if (!IsUsingStub(DEBUG_DAEMON))
121 debug_daemon_client_.reset(DebugDaemonClient::Create()); 129 debug_daemon_client_.reset(DebugDaemonClient::Create());
122 else 130 else
123 debug_daemon_client_.reset(new FakeDebugDaemonClient); 131 debug_daemon_client_.reset(new FakeDebugDaemonClient);
124 132
125 if (!IsUsingStub(EASY_UNLOCK)) 133 if (!IsUsingStub(EASY_UNLOCK))
126 easy_unlock_client_.reset(EasyUnlockClient::Create()); 134 easy_unlock_client_.reset(EasyUnlockClient::Create());
127 else 135 else
128 easy_unlock_client_.reset(new FakeEasyUnlockClient); 136 easy_unlock_client_.reset(new FakeEasyUnlockClient);
129 137
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 unstub_mask |= client; 237 unstub_mask |= client;
230 } else { 238 } else {
231 LOG(ERROR) << "Unknown dbus client: " << cur; 239 LOG(ERROR) << "Unknown dbus client: " << cur;
232 } 240 }
233 } 241 }
234 242
235 return unstub_mask; 243 return unstub_mask;
236 } 244 }
237 245
238 } // namespace chromeos 246 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698