1 // Copyright 2013 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 #include "chrome/browser/extensions/api/music_manager_private/music_manager_private_api.h"
7 #include "chrome/browser/extensions/api/music_manager_private/device_id.h"
9 using content::BrowserThread
;
13 const char kDeviceIdNotSupported
[] =
14 "Device ID API is not supported on this platform.";
18 namespace extensions
{
21 MusicManagerPrivateGetDeviceIdFunction::
22 MusicManagerPrivateGetDeviceIdFunction() {
25 MusicManagerPrivateGetDeviceIdFunction::
26 ~MusicManagerPrivateGetDeviceIdFunction() {
29 bool MusicManagerPrivateGetDeviceIdFunction::RunAsync() {
30 DCHECK_CURRENTLY_ON(BrowserThread::UI
);
31 DeviceId::GetDeviceId(
34 &MusicManagerPrivateGetDeviceIdFunction::DeviceIdCallback
,
36 return true; // Still processing!
39 void MusicManagerPrivateGetDeviceIdFunction::DeviceIdCallback(
40 const std::string
& device_id
) {
41 DCHECK_CURRENTLY_ON(BrowserThread::UI
);
43 if (device_id
.empty()) {
44 SetError(kDeviceIdNotSupported
);
47 SetResult(new base::StringValue(device_id
));
51 SendResponse(response
);
55 } // namespace extensions