Reland "Replace Chrome IPC with Mojo IPC for querying BatteryStatus service"
[chromium-blink-merge.git] / device / battery / BUILD.gn
blob498643c7b785c7423f5585629b70b5200c11297d
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
3 # found in the LICENSE file.
5 import("//build/config/features.gni")
6 import("//mojo/public/tools/bindings/mojom.gni")
8 component("battery") {
9   output_name = "device_battery"
11   sources = [
12     "battery_export.h",
13     "battery_monitor_impl.cc",
14     "battery_monitor_impl.h",
15     "battery_status_manager_android.cc",
16     "battery_status_manager_android.h",
17     "battery_status_manager_chromeos.cc",
18     "battery_status_manager_default.cc",
19     "battery_status_manager_linux.cc",
20     "battery_status_manager_linux.h",
21     "battery_status_manager_mac.cc",
22     "battery_status_manager_win.cc",
23     "battery_status_manager_win.h",
24     "battery_status_service.cc",
25     "battery_status_service.h",
26   ]
28   defines = [
29     "DEVICE_BATTERY_IMPLEMENTATION",
30   ]
32   deps = [
33     ":mojo_bindings",
34     "//base",
35     "//base/third_party/dynamic_annotations",
36     "//mojo/environment:chromium",
37     "//mojo/public/cpp/bindings",
38     "//mojo/edk/system",
39   ]
41   if (is_android) {
42     deps += [
43       "//device/battery/android:battery_jni_headers",
44     ]
45     sources += [
46       "android/battery_jni_registrar.h",
47       "android/battery_jni_registrar.cc",
48     ]
49     sources -= [
50       "battery_status_manager_default.cc",
51     ]
52   }
54   if (is_chromeos) {
55     configs += [
56       "//build/config/linux:dbus",
57     ]
58     deps += [
59       "//chromeos:power_manager_proto",
60     ]
61     sources -= [
62       "battery_status_manager_default.cc",
63       "battery_status_manager_linux.cc",
64     ]
65   }
67   if (is_linux) {
68     if (use_dbus) {
69       configs += [
70         "//build/config/linux:dbus",
71       ]
72       deps += [
73         "//dbus"
74       ]
75       sources -= [
76         "battery_status_manager_default.cc",
77       ]
78     } else {
79       sources -= [
80         "battery_status_manager_linux.cc",
81       ]
82     }
83   }
85   if (is_mac) {
86     sources -= [
87       "battery_status_manager_default.cc",
88     ]
89   }
91   if (is_win) {
92     sources -= [
93       "battery_status_manager_default.cc",
94     ]
95   }
98 mojom("mojo_bindings") {
99   sources = [
100     "battery_monitor.mojom",
101     "battery_status.mojom",
102   ]