Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(802)

Side by Side Diff: chrome/browser/extensions/api/music_manager_private/music_manager_private_api.cc

Issue 15738013: Initial implementation of music manager private API. (Closed) Base URL: https://git.chromium.org/chromium/src.git@master
Patch Set: Code review feedback. Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 const char kDeviceIDNotSupported[] =
12 "Device ID API is not supported on this platform.";
13
battre 2013/05/23 09:44:16 nit: remove newline?
rpaquay 2013/05/23 17:40:38 Done.
14 }
15
16 namespace extensions {
17
18 namespace api {
19
20 MusicManagerPrivateGetDeviceIdFunction::
21 MusicManagerPrivateGetDeviceIdFunction() {
battre 2013/05/23 09:44:16 nit: -2 spaces? (also below)
rpaquay 2013/05/23 17:40:38 Done.
22 }
23
24 MusicManagerPrivateGetDeviceIdFunction::
25 ~MusicManagerPrivateGetDeviceIdFunction() {
26 }
27
28 bool MusicManagerPrivateGetDeviceIdFunction::RunImpl() {
29 BrowserThread::PostTask(
30 BrowserThread::IO, FROM_HERE,
31 base::Bind(&MusicManagerPrivateGetDeviceIdFunction::ComputeOnIOThread,
32 this));
33
34 return true;
35 }
36
37 void MusicManagerPrivateGetDeviceIdFunction::ComputeOnIOThread() {
38 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
39
40 std::string salt = this->extension_id();
41 std::string result = device_id::GetDeviceID(salt);
42 bool response;
43 if (result.empty()) {
44 SetError(kDeviceIDNotSupported);
45 response = false;
46 } else {
47 SetResult(Value::CreateStringValue(result));
48 response = true;
49 }
50
51 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE,
52 base::Bind(&MusicManagerPrivateGetDeviceIdFunction::SendResponse,
53 this,
54 response));
55 }
56
57 } // namespace api
58
59 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698