OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/extensions/api/system_private/system_private_api.h" | 5 #include "chrome/browser/extensions/api/system_private/system_private_api.h" |
6 | 6 |
7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
10 #include "chrome/browser/extensions/event_router_forwarder.h" | 10 #include "chrome/browser/extensions/event_router_forwarder.h" |
11 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
12 #include "chrome/common/extensions/api/system_private.h" | 12 #include "chrome/common/extensions/api/system_private.h" |
13 #include "chrome/common/pref_names.h" | 13 #include "chrome/common/pref_names.h" |
14 #include "google_apis/google_api_keys.h" | |
15 | 14 |
16 #if defined(OS_CHROMEOS) | 15 #if defined(OS_CHROMEOS) |
17 #include "chromeos/dbus/dbus_thread_manager.h" | 16 #include "chromeos/dbus/dbus_thread_manager.h" |
18 #include "chromeos/dbus/update_engine_client.h" | 17 #include "chromeos/dbus/update_engine_client.h" |
19 #else | 18 #else |
20 #include "chrome/browser/upgrade_detector.h" | 19 #include "chrome/browser/upgrade_detector.h" |
21 #endif | 20 #endif |
22 | 21 |
23 namespace { | 22 namespace { |
24 | 23 |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 } | 125 } |
127 #endif | 126 #endif |
128 base::DictionaryValue* dict = new base::DictionaryValue(); | 127 base::DictionaryValue* dict = new base::DictionaryValue(); |
129 dict->SetString(kStateKey, state); | 128 dict->SetString(kStateKey, state); |
130 dict->SetDouble(kDownloadProgressKey, download_progress); | 129 dict->SetDouble(kDownloadProgressKey, download_progress); |
131 SetResult(dict); | 130 SetResult(dict); |
132 | 131 |
133 return true; | 132 return true; |
134 } | 133 } |
135 | 134 |
136 bool SystemPrivateGetApiKeyFunction::RunImpl() { | |
137 SetResult(new base::StringValue(google_apis::GetAPIKey())); | |
138 return true; | |
139 } | |
140 | |
141 void DispatchVolumeChangedEvent(double volume, bool is_volume_muted) { | 135 void DispatchVolumeChangedEvent(double volume, bool is_volume_muted) { |
142 base::DictionaryValue* dict = new base::DictionaryValue(); | 136 base::DictionaryValue* dict = new base::DictionaryValue(); |
143 dict->SetDouble(kVolumeKey, volume); | 137 dict->SetDouble(kVolumeKey, volume); |
144 dict->SetBoolean(kIsVolumeMutedKey, is_volume_muted); | 138 dict->SetBoolean(kIsVolumeMutedKey, is_volume_muted); |
145 DispatchEvent(system_private::OnVolumeChanged::kEventName, dict); | 139 DispatchEvent(system_private::OnVolumeChanged::kEventName, dict); |
146 } | 140 } |
147 | 141 |
148 void DispatchBrightnessChangedEvent(int brightness, bool user_initiated) { | 142 void DispatchBrightnessChangedEvent(int brightness, bool user_initiated) { |
149 base::DictionaryValue* dict = new base::DictionaryValue(); | 143 base::DictionaryValue* dict = new base::DictionaryValue(); |
150 dict->SetInteger(kBrightnessKey, brightness); | 144 dict->SetInteger(kBrightnessKey, brightness); |
151 dict->SetBoolean(kUserInitiatedKey, user_initiated); | 145 dict->SetBoolean(kUserInitiatedKey, user_initiated); |
152 DispatchEvent(system_private::OnBrightnessChanged::kEventName, dict); | 146 DispatchEvent(system_private::OnBrightnessChanged::kEventName, dict); |
153 } | 147 } |
154 | 148 |
155 void DispatchScreenUnlockedEvent() { | 149 void DispatchScreenUnlockedEvent() { |
156 DispatchEvent(system_private::OnScreenUnlocked::kEventName, NULL); | 150 DispatchEvent(system_private::OnScreenUnlocked::kEventName, NULL); |
157 } | 151 } |
158 | 152 |
159 void DispatchWokeUpEvent() { | 153 void DispatchWokeUpEvent() { |
160 DispatchEvent(system_private::OnWokeUp::kEventName, NULL); | 154 DispatchEvent(system_private::OnWokeUp::kEventName, NULL); |
161 } | 155 } |
162 | 156 |
163 } // namespace extensions | 157 } // namespace extensions |
OLD | NEW |