Add new certificateProvider extension API.
[chromium-blink-merge.git] / chrome / browser / extensions / api / music_manager_private / music_manager_private_api.cc
blobb51ec55d2ff3a21762522d802c9d20537784e81e
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;
11 namespace {
13 const char kDeviceIdNotSupported[] =
14 "Device ID API is not supported on this platform.";
18 namespace extensions {
19 namespace api {
21 MusicManagerPrivateGetDeviceIdFunction::
22 MusicManagerPrivateGetDeviceIdFunction() {
25 MusicManagerPrivateGetDeviceIdFunction::
26 ~MusicManagerPrivateGetDeviceIdFunction() {
29 bool MusicManagerPrivateGetDeviceIdFunction::RunAsync() {
30 DCHECK_CURRENTLY_ON(BrowserThread::UI);
31 DeviceId::GetDeviceId(
32 this->extension_id(),
33 base::Bind(
34 &MusicManagerPrivateGetDeviceIdFunction::DeviceIdCallback,
35 this));
36 return true; // Still processing!
39 void MusicManagerPrivateGetDeviceIdFunction::DeviceIdCallback(
40 const std::string& device_id) {
41 DCHECK_CURRENTLY_ON(BrowserThread::UI);
42 bool response;
43 if (device_id.empty()) {
44 SetError(kDeviceIdNotSupported);
45 response = false;
46 } else {
47 SetResult(new base::StringValue(device_id));
48 response = true;
51 SendResponse(response);
54 } // namespace api
55 } // namespace extensions