OLD | NEW |
(Empty) | |
| 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. |
| 4 |
| 5 #include "chrome/browser/extensions/api/music_manager_private/music_manager_priv
ate_api.h" |
| 6 #include "chrome/browser/extensions/api/music_manager_private/device_id.h" |
| 7 |
| 8 using content::BrowserThread; |
| 9 |
| 10 namespace { |
| 11 |
| 12 const char kDeviceIDNotSupported[] = |
| 13 "Device ID API is not supported on this platform."; |
| 14 |
| 15 } |
| 16 |
| 17 namespace extensions { |
| 18 |
| 19 namespace api { |
| 20 |
| 21 MusicManagerPrivateGetDeviceIdFunction:: |
| 22 MusicManagerPrivateGetDeviceIdFunction() { |
| 23 } |
| 24 |
| 25 MusicManagerPrivateGetDeviceIdFunction:: |
| 26 ~MusicManagerPrivateGetDeviceIdFunction() { |
| 27 } |
| 28 |
| 29 bool MusicManagerPrivateGetDeviceIdFunction::RunImpl() { |
| 30 std::string salt = this->extension_id(); |
| 31 std::string result = device_id::GetDeviceID(salt); |
| 32 bool response; |
| 33 if (result.empty()) { |
| 34 SetError(kDeviceIDNotSupported); |
| 35 response = false; |
| 36 } else { |
| 37 SetResult(Value::CreateStringValue(result)); |
| 38 response = true; |
| 39 } |
| 40 |
| 41 SendResponse(response); |
| 42 return response; |
| 43 } |
| 44 |
| 45 } // namespace api |
| 46 |
| 47 } // namespace extensions |
OLD | NEW |