OLD | NEW |
1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium OS 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 <cstdio> | 5 #include <cstdio> |
6 #include <dlfcn.h> | 6 #include <dlfcn.h> |
7 #include <string.h> | 7 #include <string.h> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include <base/basictypes.h> | 10 #include <base/basictypes.h> |
11 | 11 |
| 12 #include "chromeos_brightness.h" // NOLINT |
12 #include "chromeos_cros_api.h" // NOLINT | 13 #include "chromeos_cros_api.h" // NOLINT |
13 #include "chromeos_cryptohome.h" // NOLINT | 14 #include "chromeos_cryptohome.h" // NOLINT |
14 #include "chromeos_imageburn.h" //NOLINT | 15 #include "chromeos_imageburn.h" //NOLINT |
15 #include "chromeos_input_method.h" // NOLINT | 16 #include "chromeos_input_method.h" // NOLINT |
16 #include "chromeos_input_method_ui.h" // NOLINT | 17 #include "chromeos_input_method_ui.h" // NOLINT |
17 #include "chromeos_keyboard.h" // NOLINT | 18 #include "chromeos_keyboard.h" // NOLINT |
18 #include "chromeos_login.h" // NOLINT | 19 #include "chromeos_login.h" // NOLINT |
19 #include "chromeos_mount.h" // NOLINT | 20 #include "chromeos_mount.h" // NOLINT |
20 #include "chromeos_network.h" // NOLINT | 21 #include "chromeos_network.h" // NOLINT |
21 #include "chromeos_power.h" // NOLINT | 22 #include "chromeos_power.h" // NOLINT |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 | 312 |
312 // Syslogs | 313 // Syslogs |
313 DECL_FUNC_2(GetSystemLogs, LogDictionaryType*, FilePath*, const std::string&); | 314 DECL_FUNC_2(GetSystemLogs, LogDictionaryType*, FilePath*, const std::string&); |
314 | 315 |
315 // System | 316 // System |
316 DECL_FUNC_0(GetTimezoneID, std::string); | 317 DECL_FUNC_0(GetTimezoneID, std::string); |
317 DECL_FUNC_1(SetTimezoneID, void, const std::string& id); | 318 DECL_FUNC_1(SetTimezoneID, void, const std::string& id); |
318 DECL_FUNC_0(GetMachineInfo, MachineInfo*); | 319 DECL_FUNC_0(GetMachineInfo, MachineInfo*); |
319 DECL_FUNC_1(FreeMachineInfo, void, MachineInfo*); | 320 DECL_FUNC_1(FreeMachineInfo, void, MachineInfo*); |
320 | 321 |
| 322 // Brightness |
| 323 DECL_FUNC_2(MonitorBrightness, |
| 324 BrightnessConnection, |
| 325 BrightnessMonitorFunction, |
| 326 void*); |
| 327 DECL_FUNC_1(DisconnectBrightness, void, BrightnessConnection); |
| 328 |
321 | 329 |
322 char const * const kCrosDefaultPath = "/opt/google/chrome/chromeos/libcros.so"; | 330 char const * const kCrosDefaultPath = "/opt/google/chrome/chromeos/libcros.so"; |
323 | 331 |
324 // Initializes the variable by looking up the function by |name|. | 332 // Initializes the variable by looking up the function by |name|. |
325 // This macro uses the variable 'handle' and 'error_string'. | 333 // This macro uses the variable 'handle' and 'error_string'. |
326 #define INIT_FUNC(name) \ | 334 #define INIT_FUNC(name) \ |
327 name = name##Type(::dlsym(handle, "ChromeOS"#name)); \ | 335 name = name##Type(::dlsym(handle, "ChromeOS"#name)); \ |
328 if (!name) { \ | 336 if (!name) { \ |
329 error_string += "Couldn't load: "#name","; \ | 337 error_string += "Couldn't load: "#name","; \ |
330 } | 338 } |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
561 | 569 |
562 // Syslogs | 570 // Syslogs |
563 INIT_FUNC(GetSystemLogs); | 571 INIT_FUNC(GetSystemLogs); |
564 | 572 |
565 // System | 573 // System |
566 INIT_FUNC(GetTimezoneID); | 574 INIT_FUNC(GetTimezoneID); |
567 INIT_FUNC(SetTimezoneID); | 575 INIT_FUNC(SetTimezoneID); |
568 INIT_FUNC(GetMachineInfo); | 576 INIT_FUNC(GetMachineInfo); |
569 INIT_FUNC(FreeMachineInfo); | 577 INIT_FUNC(FreeMachineInfo); |
570 | 578 |
| 579 // Brightness |
| 580 INIT_FUNC(MonitorBrightness); |
| 581 INIT_FUNC(DisconnectBrightness); |
| 582 |
571 return error_string.empty(); | 583 return error_string.empty(); |
572 } | 584 } |
573 | 585 |
574 } // namespace chromeos | 586 } // namespace chromeos |
OLD | NEW |