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